mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
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. |
||
|---|---|---|
| .. | ||
| migstreams | ||
| sqlc | ||
| sqlcmig6 | ||
| interfaces.go | ||
| log.go | ||
| migrations.go | ||
| postgres.go | ||
| postgres_fixture.go | ||
| schemas.go | ||
| sqlerrors.go | ||
| sqlite.go | ||