Summary
QueryHooks + runWithHooks already measure durationMs and fire onQueryStart/onQueryEnd. Two gaps: (a) the params field declared on every hook event is never populated — hooks receive only { sql, kind }, so consumers can't log bound values; (b) no built-in slow-query warning.
Proposal
- Populate
paramson the hook events. - Add
config.hooks.slowQueryThresholdMs(oronSlowQuery) that fires whendurationMsexceeds it, reusing the existing timing.
This is also the closest feasible proxy for the connection-leak detection deferred in #1014 (Bun's pool exposes no checkout hooks).
Effort: S. Location: src/client.ts runWithHooks (~2364), src/types.ts QueryHooks (~203). Found via internal code audit.