perf(bdk): harden pg wallet cache and large-wallet sync paths#59
perf(bdk): harden pg wallet cache and large-wallet sync paths#59
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the Postgres-backed BDK wallet database implementation to separate caching, lookup, and trait implementations, while improving large-wallet sync performance by adding paged/streamed loaders and batched miss resolution.
Changes:
- Split
SqlxWalletDbresponsibilities into newcache,lookups, anddb_traitsmodules (plus updated tests). - Add batched lookup helpers (
find_by_ids,find_paths_for_scripts) and convert full-table loads to paged streaming queries. - Update SQLx offline metadata to reflect new/modified queries.
Reviewed changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/bdk/pg/utxos.rs | Removes non-transactional persist_all helper, leaving transactional persist path. |
| src/bdk/pg/transactions.rs | Adds paging/streaming loaders and find_by_ids for batched tx fetches. |
| src/bdk/pg/script_pubkeys.rs | Adds batched script-path lookup and paged/streamed script listing. |
| src/bdk/pg/mod.rs | Reorganizes module structure; updates/extends WalletCache tests. |
| src/bdk/pg/lookups.rs | Introduces centralized lookup logic + miss batching policy. |
| src/bdk/pg/db_traits.rs | Moves BDK trait implementations and adds post-commit cache invalidation behavior. |
| src/bdk/pg/cache.rs | New wallet cache implementation, including miss/pending tracking and invalidation. |
| .sqlx/query-*.json | Adds/updates SQLx offline query metadata for new/changed SQL. |
Files not reviewed (3)
- .sqlx/query-1c966653b607ef9cd8a305aac131cf64a17ab0803fdc55db8b55a14fced7178d.json: Language not supported
- .sqlx/query-456fb4994f750068fc126ac3add78fbc539b5073bdfa1265760869e094353ade.json: Language not supported
- .sqlx/query-fbfacf3613c2dbe990a8c02ea2755ea2c981b717f87a42e83cd934d2abf33443.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 13 changed files in this pull request and generated 2 comments.
Files not reviewed (3)
- .sqlx/query-1c966653b607ef9cd8a305aac131cf64a17ab0803fdc55db8b55a14fced7178d.json: Language not supported
- .sqlx/query-68df480b792fa014a5d66aa05f2d7caa1305d81382f32f2b55c36d31fa8e3583.json: Language not supported
- .sqlx/query-fbfacf3613c2dbe990a8c02ea2755ea2c981b717f87a42e83cd934d2abf33443.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 13 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- .sqlx/query-1c966653b607ef9cd8a305aac131cf64a17ab0803fdc55db8b55a14fced7178d.json: Language not supported
- .sqlx/query-68df480b792fa014a5d66aa05f2d7caa1305d81382f32f2b55c36d31fa8e3583.json: Language not supported
- .sqlx/query-fbfacf3613c2dbe990a8c02ea2755ea2c981b717f87a42e83cd934d2abf33443.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 13 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- .sqlx/query-1c966653b607ef9cd8a305aac131cf64a17ab0803fdc55db8b55a14fced7178d.json: Language not supported
- .sqlx/query-68df480b792fa014a5d66aa05f2d7caa1305d81382f32f2b55c36d31fa8e3583.json: Language not supported
- .sqlx/query-fbfacf3613c2dbe990a8c02ea2755ea2c981b717f87a42e83cd934d2abf33443.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 13 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- .sqlx/query-1c966653b607ef9cd8a305aac131cf64a17ab0803fdc55db8b55a14fced7178d.json: Language not supported
- .sqlx/query-68df480b792fa014a5d66aa05f2d7caa1305d81382f32f2b55c36d31fa8e3583.json: Language not supported
- .sqlx/query-fbfacf3613c2dbe990a8c02ea2755ea2c981b717f87a42e83cd934d2abf33443.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 13 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- .sqlx/query-1c966653b607ef9cd8a305aac131cf64a17ab0803fdc55db8b55a14fced7178d.json: Language not supported
- .sqlx/query-68df480b792fa014a5d66aa05f2d7caa1305d81382f32f2b55c36d31fa8e3583.json: Language not supported
- .sqlx/query-fbfacf3613c2dbe990a8c02ea2755ea2c981b717f87a42e83cd934d2abf33443.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 13 changed files in this pull request and generated 4 comments.
Files not reviewed (3)
- .sqlx/query-1c966653b607ef9cd8a305aac131cf64a17ab0803fdc55db8b55a14fced7178d.json: Language not supported
- .sqlx/query-68df480b792fa014a5d66aa05f2d7caa1305d81382f32f2b55c36d31fa8e3583.json: Language not supported
- .sqlx/query-fbfacf3613c2dbe990a8c02ea2755ea2c981b717f87a42e83cd934d2abf33443.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 13 changed files in this pull request and generated no new comments.
Files not reviewed (3)
- .sqlx/query-1c966653b607ef9cd8a305aac131cf64a17ab0803fdc55db8b55a14fced7178d.json: Language not supported
- .sqlx/query-68df480b792fa014a5d66aa05f2d7caa1305d81382f32f2b55c36d31fa8e3583.json: Language not supported
- .sqlx/query-fbfacf3613c2dbe990a8c02ea2755ea2c981b717f87a42e83cd934d2abf33443.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
SqlxWalletDbinternals by splitting cache, lookup, and trait implementation concerns for readability while preserving behavior