lightning-terminal/db/sqlc
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
..
migrations multi: rename sql kvstores session_id to group_id 2025-07-21 14:45:45 +02:00
migrations_dev multi: add dev kvdb to sql code migration 2026-05-14 11:38:35 +02:00
queries accounts+sqlc: improve ListAccounts for SQL store 2026-05-14 11:38:48 +02:00
accounts.sql.go accounts+sqlc: improve ListAccounts for SQL store 2026-05-14 11:38:48 +02:00
actions.sql.go sqlc+firewalldb: add GetAction SQL query 2025-10-07 02:13:14 +02:00
actions_custom.go db: define manual action SQL queries 2025-05-30 10:54:34 +02:00
db.go db/sqlc: add account related tables and queries 2025-01-29 16:37:20 +02:00
db_custom.go multi: remove unused db code 2026-05-14 11:37:52 +02:00
kvstores.sql.go multi: rename sql kvstores session_id to group_id 2025-07-21 14:45:45 +02:00
models.go multi: rename sql kvstores session_id to group_id 2025-07-21 14:45:45 +02:00
privacy_paris.sql.go db/sqlc: priv map schemas and crud 2025-04-22 06:10:48 +02:00
querier.go accounts+sqlc: improve ListAccounts for SQL store 2026-05-14 11:38:48 +02:00
sessions.sql.go sqlc: add DeleteSession query 2025-11-25 19:35:42 +01:00