Skip to content

Commit 037e109

Browse files
committed
store: Remove unused Layout.count_query
1 parent 725db3e commit 037e109

1 file changed

Lines changed: 3 additions & 25 deletions

File tree

store/postgres/src/relational.rs

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use graph::data::graphql::TypeExt as _;
3838
use graph::data::query::Trace;
3939
use graph::data::value::Word;
4040
use graph::data_source::CausalityRegion;
41-
use graph::prelude::{q, EntityQuery, StopwatchMetrics, ENV_VARS};
41+
use graph::prelude::{q, EntityChange, EntityQuery, StopwatchMetrics, ENV_VARS};
4242
use graph::schema::{
4343
EntityKey, EntityType, Field, FulltextConfig, FulltextDefinition, InputSchema,
4444
};
@@ -72,8 +72,8 @@ use graph::components::store::{AttributeNames, DerivedEntityQuery};
7272
use graph::data::store::{Id, IdList, IdType, BYTES_SCALAR};
7373
use graph::data::subgraph::schema::POI_TABLE;
7474
use graph::prelude::{
75-
anyhow, info, BlockNumber, DeploymentHash, Entity, EntityChange, EntityOperation, Logger,
76-
QueryExecutionError, StoreError, StoreEvent, ValueType, BLOCK_NUMBER_MAX,
75+
anyhow, info, BlockNumber, DeploymentHash, Entity, EntityOperation, Logger,
76+
QueryExecutionError, StoreError, StoreEvent, ValueType,
7777
};
7878

7979
use crate::block_range::{BoundSide, BLOCK_COLUMN, BLOCK_RANGE_COLUMN};
@@ -231,8 +231,6 @@ pub struct Layout {
231231
pub tables: HashMap<EntityType, Arc<Table>>,
232232
/// The database schema for this subgraph
233233
pub catalog: Catalog,
234-
/// The query to count all entities
235-
pub count_query: String,
236234
/// How many blocks of history the subgraph should keep
237235
pub history_blocks: BlockNumber,
238236

@@ -290,25 +288,6 @@ impl Layout {
290288
))
291289
}
292290

293-
let count_query = tables
294-
.iter()
295-
.map(|table| {
296-
if table.immutable {
297-
format!(
298-
"select count(*) from \"{}\".\"{}\"",
299-
&catalog.site.namespace, table.name
300-
)
301-
} else {
302-
format!(
303-
"select count(*) from \"{}\".\"{}\" where block_range @> {}",
304-
&catalog.site.namespace, table.name, BLOCK_NUMBER_MAX
305-
)
306-
}
307-
})
308-
.collect::<Vec<_>>()
309-
.join("\nunion all\n");
310-
let count_query = format!("select sum(e.count) from ({}) e", count_query);
311-
312291
let tables: HashMap<_, _> = tables
313292
.into_iter()
314293
.fold(HashMap::new(), |mut tables, table| {
@@ -322,7 +301,6 @@ impl Layout {
322301
site,
323302
catalog,
324303
tables,
325-
count_query,
326304
history_blocks: i32::MAX,
327305
input_schema: schema.cheap_clone(),
328306
rollups,

0 commit comments

Comments
 (0)