We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4b21d04 + 6ff4248 commit 662a3c5Copy full SHA for 662a3c5
orm/migrations/2025-08-06-084026_block_timestamp_index/down.sql
@@ -0,0 +1 @@
1
+DROP INDEX idx_block_timestamp;
orm/migrations/2025-08-06-084026_block_timestamp_index/up.sql
+CREATE INDEX idx_block_timestamp ON blocks(timestamp);
webserver/src/repository/block.rs
@@ -63,8 +63,11 @@ impl BlockRepositoryTrait for BlockRepository {
63
.expect("Invalid timestamp")
64
.naive_utc();
65
66
+ let lower_bound = timestamp - chrono::Duration::seconds(60);
67
+
68
conn.interact(move |conn| {
69
blocks::table
70
+ .filter(blocks::timestamp.ge(lower_bound))
71
.filter(blocks::timestamp.le(timestamp))
72
.order(blocks::timestamp.desc())
73
.select(BlockDb::as_select())
0 commit comments