Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Sequin backfills paginate with a keyset cursor of (sort column, primary key),
-- e.g. WHERE ("last_synced_at", "id", "package_id") >= ($1, $2, $3) ORDER BY ... LIMIT n.
-- Without these indexes every page is a full sort (28M+ rows on versions,
-- 44M+ on package_dependencies) and hits Sequin's per-query timeout.
-- CONCURRENTLY relies on flyway's -mixed=true to run outside a transaction.

CREATE INDEX CONCURRENTLY IF NOT EXISTS versions_last_synced_at_id_package_id_idx
ON versions (last_synced_at, id, package_id);
Comment on lines +7 to +8

CREATE INDEX CONCURRENTLY IF NOT EXISTS package_dependencies_updated_at_id_depends_on_id_idx
ON package_dependencies (updated_at, id, depends_on_id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concurrent index on partitioned tables

High Severity

The migration runs CREATE INDEX CONCURRENTLY on versions and package_dependencies, which are hash-partitioned parents. On PostgreSQL 14 (the version used for the packages DB in this repo), concurrent index builds on partitioned tables are rejected, so Flyway can fail before either backfill index exists.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ceca499. Configure here.

Comment on lines +10 to +11
Loading
Loading