graphql-engine/server/src-rsr/pg_source_migrations/1_to_2.sql
kodiakhq[bot] 01d8a37706 server: fix asymptotics of event_log batch fetching
Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com>
GitOrigin-RevId: 9b8afb502e94dd371a8596ccde97d023bd2344a9
2021-06-01 17:34:38 +00:00

12 lines
373 B
SQL

DROP INDEX hdb_catalog.event_log_locked_idx;
DROP INDEX hdb_catalog.event_log_delivered_idx;
DROP INDEX hdb_catalog.event_log_created_at_idx;
/* This index powers `fetchEvents` */
CREATE INDEX event_log_fetch_events
ON hdb_catalog.event_log (locked NULLS FIRST, next_retry_at NULLS FIRST, created_at)
WHERE delivered = 'f'
and error = 'f'
and archived = 'f'
;