Skip to content

[INF-1722] Keep single deletes on primary key - #18

Merged
thesyncim merged 1 commit into
mainfrom
codex/inf-1722-pk-delete-plan
Aug 26, 2026
Merged

[INF-1722] Keep single deletes on primary key#18
thesyncim merged 1 commit into
mainfrom
codex/inf-1722-pk-delete-plan

Conversation

@thesyncim

Copy link
Copy Markdown
Member

Ticket

Summary

Remove redundant equal lower and upper composite-row bounds from single-row primary-key DELETEs. In the live c3 target, those bounds made PostgreSQL choose the 39 GB channels_app_pk_created_at_cid_retention_idx instead of the unique channels_pkey, producing a roughly 4.5 minute delete outlier.

Exact scalar equalities remain in catalog primary-key order, so row identity and delete semantics are unchanged while the planner can select the unique primary key.

Validation

  • go test ./...
  • go vet ./...
  • go test -race ./internal/cdc
  • Live read-only EXPLAIN: bounded predicate selected the retention index; exact PK equalities selected channels_pkey

Rollout

  • The target-only retention index is temporarily deferred during c3 catchup.
  • Do not deploy this follow-up image during catchup without explicit approval.
  • Before cutover, deploy the fix, recreate the deferred target index concurrently in follow mode, and verify it is ready/valid and replay remains current.
  • No source schema or row changes.

Checklist

  • The changed code has been covered with unit tests
  • No API endpoints changed
  • No documentation change is required

@thesyncim
thesyncim merged commit 88bc3d2 into main Aug 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant