Skip to content

Commit 553b6ac

Browse files
committed
graph, store: Remove VersionStats.block_range_lower
We are not using those right now and there's therefore no point in storing them
1 parent 6cd68d8 commit 553b6ac

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

graph/src/components/store/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,13 +928,12 @@ pub struct VersionStats {
928928
pub ratio: f64,
929929
/// The last block to which this table was pruned
930930
pub last_pruned_block: Option<BlockNumber>,
931-
/// Histograms for the lower and upper bounds of the block ranges in
931+
/// Histograms for the upper bounds of the block ranges in
932932
/// this table. Each histogram bucket contains roughly the same number
933933
/// of rows; values might be repeated to achieve that. The vectors are
934934
/// empty if the table hasn't been analyzed, the subgraph is stored in
935935
/// Postgres version 16 or lower, or if the table doesn't have a
936936
/// block_range column.
937-
pub block_range_lower: Vec<BlockNumber>,
938937
pub block_range_upper: Vec<BlockNumber>,
939938
}
940939

store/postgres/src/catalog.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ impl Catalog {
305305
tablename: s.tablename,
306306
ratio: s.ratio,
307307
last_pruned_block: s.last_pruned_block,
308-
block_range_lower: vec![],
309308
block_range_upper: vec![],
310309
}
311310
}
@@ -316,8 +315,6 @@ impl Catalog {
316315
#[diesel(sql_type = Text)]
317316
tablename: String,
318317
#[diesel(sql_type = Array<Integer>)]
319-
lower: Vec<i32>,
320-
#[diesel(sql_type = Array<Integer>)]
321318
upper: Vec<i32>,
322319
}
323320

@@ -327,7 +324,6 @@ impl Catalog {
327324
) -> Result<Vec<RangeHistogram>, StoreError> {
328325
let query = format!(
329326
"select tablename, \
330-
array_agg(lower(block_range)) lower, \
331327
array_agg(coalesce(upper(block_range), {BLOCK_NUMBER_MAX})) upper \
332328
from (select tablename,
333329
unnest(range_bounds_histogram::text::int4range[]) block_range
@@ -386,16 +382,14 @@ impl Catalog {
386382
let pos = range_histogram
387383
.iter()
388384
.position(|h| h.tablename == s.tablename);
389-
let (mut lower, mut upper) = pos
385+
let mut upper = pos
390386
.map(|pos| range_histogram.swap_remove(pos))
391-
.map(|h| (h.lower, h.upper))
392-
.unwrap_or((vec![], vec![]));
387+
.map(|h| h.upper)
388+
.unwrap_or(vec![]);
393389
// Since lower and upper are supposed to be histograms, we
394390
// sort them
395-
lower.sort_unstable();
396391
upper.sort_unstable();
397392
let mut vs = VersionStats::from(s);
398-
vs.block_range_lower = lower;
399393
vs.block_range_upper = upper;
400394
vs
401395
})

store/test-store/tests/postgres/graft.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,6 @@ fn prune() {
648648
tablename: USER.to_ascii_lowercase(),
649649
ratio: 3.0 / 5.0,
650650
last_pruned_block: None,
651-
block_range_lower: vec![],
652651
block_range_upper: vec![],
653652
};
654653
assert_eq!(

0 commit comments

Comments
 (0)