Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use condition instead of coalesce for updates on cdc_batches #2423

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

iamKunalGupta
Copy link
Member

@iamKunalGupta iamKunalGupta commented Jan 10, 2025

Existing query can cause problems on mirrors with very low sync interval as the batches table grows large

@iamKunalGupta iamKunalGupta requested a review from a team January 10, 2025 02:06
@@ -0,0 +1 @@
CREATE INDEX IF NOT EXISTS idx_cdc_batches_end_time_null ON peerdb_stats.cdc_batches(end_time) WHERE end_time IS NULL;
Copy link
Contributor

@serprex serprex Jan 10, 2025

Choose a reason for hiding this comment

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

Suggested change
CREATE INDEX IF NOT EXISTS idx_cdc_batches_end_time_null ON peerdb_stats.cdc_batches(end_time) WHERE end_time IS NULL;
CREATE INDEX IF NOT EXISTS idx_cdc_batches_end_time_null ON peerdb_stats.cdc_batches USING HASH (flow_name) WHERE end_time IS NULL;

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we already have one for flow name, let me check

Copy link
Member Author

Choose a reason for hiding this comment

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

@iamKunalGupta iamKunalGupta merged commit 46a217a into main Jan 10, 2025
9 checks passed
@iamKunalGupta iamKunalGupta deleted the feat/optimize-cdc-batch-inserts branch January 10, 2025 15:18
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.

3 participants