lightning-terminal/db/sqlc/queries
Viktor Torstensson 93b9dec9b1
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-03-05 14:18:07 +01:00
..
accounts.sql accounts+sqlc: improve ListAccounts for SQL store 2026-03-05 14:18:07 +01:00
actions.sql sqlc+firewalldb: add GetAction SQL query 2025-10-07 02:13:14 +02:00
kvstores.sql multi: rename sql kvstores session_id to group_id 2025-07-21 14:45:45 +02:00
privacy_paris.sql db/sqlc: priv map schemas and crud 2025-04-22 06:10:48 +02:00
sessions.sql sqlc: add DeleteSession query 2025-11-25 19:35:42 +01:00