Closed zone117x closed 2 weeks ago
Vercel deployment URL: https://stacks-blockchain-2iy3g7ror-hirosystems.vercel.app :rocket:
All modified and coverable lines are covered by tests :white_check_mark:
:loudspeaker: Thoughts on this report? Let us know!
:tada: This PR is included in version 8.2.1-beta.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Possible fix for https://github.com/hirosystems/stacks-blockchain-api/issues/2147
In version v8.1.0, several endpoints (in particular the balance endpoints) were updated to use new etag caching handling. This change was actually an optimization to reduce db load, however, it performs a sql query that is very CPU intensive for postgres deployments without very large memory cache configurations.
This PR adds composite indexes which should be less CPU intensive than the bitmap scans required by the previously used indexes.
I was able to reproduce the slow query perf on a small-ish vm, and verify that this PR significantly improves the query:
Using this sample query: