Skip to content

Commit

Permalink
reuse_topic: Add index to timestamp bindings table (MaterializeInc#9379)
Browse files Browse the repository at this point in the history
We want `compact_timestamp_bindings` to use only indexed lookups.  We can accumulate a large number of uncompacted timestamps if the sink enters into an errored state or the frontier stops moving forward for some reason.  Because of this, we want the queries in `compact_timestamp_bindings` to be completed in near constant-time.  Therefor, we add a `(sid, timestamp)` index so that we can do these lookups much more quickly.
  • Loading branch information
cjubb39 authored Dec 2, 2021
1 parent 2158364 commit e357eaf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/coord/src/catalog/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ const MIGRATIONS: &[&str] = &[
// Introduced in v0.9.12.
"INSERT INTO schemas (database_id, name) VALUES
(NULL, 'information_schema');",
// Adds index to timestamp table to more efficiently compact timestamps.
//
// Introduced in v0.12.0.
"CREATE INDEX timestamps_sid_timestamp ON timestamps (sid, timestamp)",
// Add new migrations here.
//
// Migrations should be preceded with a comment of the following form:
Expand Down

0 comments on commit e357eaf

Please sign in to comment.