lightning-terminal/db
Viktor Torstensson fb5b0af8d8
accounts+sqlc: improve ListAccounts for SQL store
Optimize SQL account listing by preloading linked invoices and payments
for all accounts in bulk.

Before this change, Accounts() queried ListAllAccounts and then did two
extra queries per account (ListAccountInvoices/ListAccountPayments),
which scales poorly as account count grows.

Add ListAllAccountInvoices and ListAllAccountPayments queries, group
their rows by account_id in memory, and marshal each account from the
preloaded data. Keep conversion logic shared through
marshalDBAccountWithLinkedData to preserve behavior between
single-account and list-account paths.

This reduces query count from 1 + 2N to 3 and improves list-path
performance without changing external semantics.
2026-05-14 11:38:48 +02:00
..
migstreams multi: add dev kvdb to sql code migration 2026-05-14 11:38:35 +02:00
sqlc accounts+sqlc: improve ListAccounts for SQL store 2026-05-14 11:38:48 +02:00
sqlcmig6 sqlcmig6: add transaction executor for Queries 2026-05-14 11:38:02 +02:00
interfaces.go multi: remove unused db code 2026-05-14 11:37:52 +02:00
log.go multi: update LND and friends 2025-03-26 09:20:52 -05:00
migrations.go multi: add dev kvdb to sql code migration 2026-05-14 11:38:35 +02:00
postgres.go multi: introduce migration stream for unit tests 2026-05-14 11:38:24 +02:00
postgres_fixture.go db: SQL boilerplate code 2025-01-29 16:37:20 +02:00
schemas.go multi: introduce dev migrations 2026-05-14 11:38:30 +02:00
sqlerrors.go db: SQL boilerplate code 2025-01-29 16:37:20 +02:00
sqlite.go multi: remove unused db code 2026-05-14 11:37:52 +02:00