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. |
||
|---|---|---|
| .. | ||
| migrations | ||
| migrations_dev | ||
| queries | ||
| accounts.sql.go | ||
| actions.sql.go | ||
| actions_custom.go | ||
| db.go | ||
| db_custom.go | ||
| kvstores.sql.go | ||
| models.go | ||
| privacy_paris.sql.go | ||
| querier.go | ||
| sessions.sql.go | ||