Skip to content

Commit

Permalink
cometindex: add index for attributes referencing events
Browse files Browse the repository at this point in the history
This is needed to efficiently get the attributes for an event.

Without this performance explodes if pindexer is far behind.
  • Loading branch information
cronokirby committed Sep 10, 2024
1 parent 7eb5504 commit c3d6fc0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/util/cometindex/vendor/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ CREATE TABLE attributes (
UNIQUE (event_id, key)
);

-- To make it efficient to fetch the attributes of a given event.
CREATE INDEX ON attributes(event_id);

-- A joined view of events and their attributes. Events that do not have any
-- attributes are represented as a single row with empty key and value fields.
CREATE VIEW event_attributes AS
Expand Down

0 comments on commit c3d6fc0

Please sign in to comment.