Files
meshcore-hub/tests
Louis King e1199a42cd perf(api): batch N+1 dashboard and message sender queries
Two read-only query optimisations, no schema changes.

node-count history: replace the per-day COUNT(*) loop (up to 90 full
scans of the unindexed created_at column) with two queries — a baseline
count of nodes created before the window plus one GROUP BY date()
aggregate, accumulated into the running total in Python. Results are
identical; the baseline seed keeps pre-window nodes counted from day 0.

sender-name resolution: add resolve_sender_names() to observer_utils,
batching all pubkey prefixes into two queries (names + name tags) via an
OR of indexable LIKE 'prefix%' terms instead of two queries per prefix.
Wire it into list_messages (was ~2xN per page) and the dashboard
channel-messages loop (nested per channel x per prefix). The dashboard
recent-ads block already batches on full public keys via IN(), so it is
left as-is.

Tests: add cumulative+baseline correctness for node-count and a
multi-sender batched-resolution case for messages.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 11:25:01 +01:00
..