-
Notifications
You must be signed in to change notification settings - Fork 118
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: change all HASH indexes to BTREE to optimize writes #1825
Conversation
Vercel deployment URL: https://stacks-blockchain-76kamf52i-blockstack.vercel.app 🚀 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## beta #1825 +/- ##
=======================================
Coverage 71.71% 71.72%
=======================================
Files 91 91
Lines 11835 11835
Branches 2622 2622
=======================================
+ Hits 8488 8489 +1
+ Misses 3194 3193 -1
Partials 153 153 ☔ View full report in Codecov by Sentry. |
## [7.8.0-beta.3](v7.8.0-beta.2...v7.8.0-beta.3) (2024-01-12) ### Bug Fixes * change all HASH indexes to BTREE to optimize writes ([#1825](#1825)) ([234936b](234936b))
🎉 This PR is included in version 7.8.0-beta.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [7.8.0](v7.7.2...v7.8.0) (2024-01-23) ### Features * add `/extended/v2/smart-contracts/status` endpoint ([#1833](#1833)) ([3535c11](3535c11)) * run inserts in batch and in parallel when processing new block ([#1818](#1818)) ([86dfdb5](86dfdb5)) * upgrade to node 20, use bookworm-slim image ([#1832](#1832)) ([0a42109](0a42109)) ### Bug Fixes * change all HASH indexes to BTREE to optimize writes ([#1825](#1825)) ([234936b](234936b)) * log block event counts after processing ([#1820](#1820)) ([9c39743](9c39743)), closes [#1819](#1819) [#1819](#1819) * optimize re-org queries and indexes ([#1821](#1821)) ([5505d35](5505d35)) * parallelize re-org update queries ([#1835](#1835)) ([340a304](340a304))
🎉 This PR is included in version 7.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Our HASH indexes did not have enough cardinality, i.e. there were a lot of collisions which forced postgres to create "secondary" indexes of data inside each of those collisions. Changing indexes to BTREE helped reduce write latency tremendously (from ~5-10 seconds per block to ~150-900ms per block.