Budgets, not vibes
Flag database work that exceeds a latency threshold so regressions surface before users feel them.
0.x
queryd is a database query latency detector for Node.js with first-class Prisma support
($queryRaw, $executeRaw, interactive $transaction), sampling,
optional EXPLAIN ANALYZE, and pluggable sinks.
Flag database work that exceeds a latency threshold so regressions surface before users feel them.
Designed for common Node + ORM setups; the goal is ergonomic hooks instead of hand-rolled timers.
Sampling-first design so observability stays cheap enough to leave on in production.
Optional EXPLAIN pipeline to inspect the slowest offenders when you need depth, not noise.
import { PrismaClient } from "@prisma/client";
import {
createSlowQueryDetector,
wrapPrismaClient,
createConsoleLogger,
runWithDbContext,
} from "@olegkoval/queryd";
const base = new PrismaClient();
const detector = createSlowQueryDetector(
{ warnThresholdMs: 200, dbName: "primary" },
{ logger: createConsoleLogger() },
);
export const prisma = wrapPrismaClient(base, detector);
await runWithDbContext({ requestId: "req-1", userId: "u-1" }, async () => {
await prisma.$queryRaw`SELECT 1`;
});
MIT licensed · oleg-koval/slow-query-detector · package name on npm is @olegkoval/queryd