Variable: DEFAULT\_STATEMENT\_TIMEOUT\_MS
const DEFAULT_STATEMENT_TIMEOUT_MS: 15000 = 15_000;Defined in: server/insights/executor.ts:39
Read-only execution of a CompiledQuery. Every run is wrapped in ONE
transaction. SET LOCAL statement_timeout (LOCAL, so it resets at COMMIT —
pool-safe) is pinned BEFORE the first query; the rows query and its companion
(detail count / grouped totals) then run in the SAME transaction.
Snapshot guarantee — depends on who owns the transaction:
- When the executor OWNS the transaction it opens it at REPEATABLE READ, so the companion count/totals observe exactly the snapshot the rows query saw. (Under READ COMMITTED — Prisma's default — each statement takes its own snapshot, which lets a concurrent commit skew totals against rows.)
- When a caller has ALREADY opened one (e.g.
withTenantTransactionfor the RLS backstop on the same client, or the integration-test rollback tx),TransactionManager.startOrUseTransactionREUSES it and the requestedisolationLevelis silently IGNORED — a transaction's isolation level is fixed at BEGIN and can't change mid-flight. The wrapper's level applies.QueryService.executeopens the tenancy wrap at REPEATABLE READ too, so the guarantee still holds under tenancy; a bare rollback-tx test wrapper runs at its own level.
Statement ordering: the timeout SET need only PRECEDE the first query — on
the reuse path the tenant GUC (set_config, pinned by withTenantTransaction)
may legitimately have run first.