Skip to content

Commit ceca499

Browse files
committed
feat: add sequin date-based backfill script and packages sort column indexes
Signed-off-by: anilb <epipav@gmail.com>
1 parent 1c4fe98 commit ceca499

2 files changed

Lines changed: 482 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Sequin backfills paginate with a keyset cursor of (sort column, primary key),
2+
-- e.g. WHERE ("last_synced_at", "id", "package_id") >= ($1, $2, $3) ORDER BY ... LIMIT n.
3+
-- Without these indexes every page is a full sort (28M+ rows on versions,
4+
-- 44M+ on package_dependencies) and hits Sequin's per-query timeout.
5+
-- CONCURRENTLY relies on flyway's -mixed=true to run outside a transaction.
6+
7+
CREATE INDEX CONCURRENTLY IF NOT EXISTS versions_last_synced_at_id_package_id_idx
8+
ON versions (last_synced_at, id, package_id);
9+
10+
CREATE INDEX CONCURRENTLY IF NOT EXISTS package_dependencies_updated_at_id_depends_on_id_idx
11+
ON package_dependencies (updated_at, id, depends_on_id);

0 commit comments

Comments
 (0)