perf(inbounds): batch client identities for stats enrichment (#6929)

backfillClientStats loaded every column of every client once per inbound,
although enrichment only reads UUID, email and subscription ID. Each inbound
list read (panel list, the master's node traffic poll, Xray config builds,
bots) repeated that wide join per inbound. Identities now come from one narrow
clients/client_inbounds projection per 400 inbounds, honouring the supplied
transaction; stats output, sibling-traffic append order and the #6436
clients-table source of truth are unchanged.

Closes #6926
This commit is contained in:
Hamed
2026-10-25 16:31:46 +03:30
committed by GitHub
parent be25314157
commit 952c1c751a
11 changed files with 561 additions and 38 deletions
+10
View File
@@ -80,6 +80,16 @@ jobs:
exit 1
fi
- name: PostgreSQL batched stats identities
run: |
set -o pipefail
go test ./internal/web/service -run '^TestClientStatsIdentitiesPostgres$' -count=1 -v | tee /tmp/postgres-stats-identities.log
passed=$(grep -c -- '^--- PASS' /tmp/postgres-stats-identities.log || true)
if [ "$passed" -ne 1 ]; then
echo "expected 1 passing PostgreSQL stats identities test, got $passed" >&2
exit 1
fi
- name: PostgreSQL global-traffic heartbeat regressions
run: |
set -o pipefail