Skip to content

Optimize replication migration max(pk)#967

Merged
rgalanakis merged 1 commit intomainfrom
max-pk-optimization
Jun 17, 2025
Merged

Optimize replication migration max(pk)#967
rgalanakis merged 1 commit intomainfrom
max-pk-optimization

Conversation

@rgalanakis
Copy link
Contributor

If we have many rows, using max(pk) is slow since it uses an index-only scan.

Instead, take advantage of the fact that we're grabbing the maximum value of a sequence,
and look at its last_value.

If we have many rows, using `max(pk)` is slow since
it uses an index-only scan.

Instead, take advantage of the fact that we're grabbing
the maximum value of a sequence,
and look at its last_value.
@codecov
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.62%. Comparing base (72f753b) to head (510cf5c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #967   +/-   ##
=======================================
  Coverage   97.61%   97.62%           
=======================================
  Files         490      490           
  Lines       31094    31098    +4     
=======================================
+ Hits        30353    30358    +5     
+ Misses        741      740    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rgalanakis rgalanakis merged commit b4f0daf into main Jun 17, 2025
4 checks passed
@rgalanakis rgalanakis deleted the max-pk-optimization branch June 17, 2025 04:29
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