@@ -73,7 +73,7 @@ use graph::data::store::{Id, IdList, IdType, BYTES_SCALAR};
7373use graph::data::subgraph::schema::POI_TABLE;
7474use graph::prelude::{
7575 anyhow, info, BlockNumber, DeploymentHash, Entity, EntityChange, EntityOperation, Logger,
76- QueryExecutionError, StoreError, StoreEvent, ValueType, BLOCK_NUMBER_MAX,
76+ QueryExecutionError, StoreError, StoreEvent, ValueType,
7777};
7878
7979use 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