queryd - slow query detection for Node.js
The Story
queryd wraps the SQL your app actually runs — tagged templates (e.g. postgres.js), string SQL (wrapQueryFn), or Prisma via @olegkoval/queryd/prisma — with per-query latency thresholds, optional per-requestId query budgets, sampling, optional EXPLAIN ANALYZE, and pluggable sinks.
AI Overview
AI-generatedThe product solves a real pain point for teams building latency-sensitive applications. Query performance degrades gradually, and without systematic detection, slow queries often go unnoticed until they cause visible impact. Queryd brings three mechanisms to prevent this: per-query latency thresholds that flag individual slow queries, per-request query budgets that set cumulative limits on database work within a single user request, and sampling controls that keep observability costs minimal in production.
What distinguishes queryd is its pragmatic design philosophy. Rather than requiring a complete database abstraction or architectural restructuring, it integrates at the query execution layer across multiple driver APIs. The sampling-first approach acknowledges that continuous monitoring of all queries in high-traffic applications becomes prohibitively expensive; instead, teams can set sampling rates to stay within their observability budget while still surfacing meaningful regressions. Optional EXPLAIN ANALYZE integration allows deeper investigation of offending queries when needed, shifting between cheap signal and expensive detail.
The implementation provides useful context awareness through request-scoped budgets—tracking not just individual query times but also cumulative query volume and duration within a single request. This catches a different class of performance issues: endpoints that perform many quick queries instead of fewer optimized ones. The configurable sink architecture suggests thoughtful extensibility, allowing teams to route alerts to their existing monitoring systems rather than forcing a new workflow.
As an early-stage open-source project, queryd makes a modest but useful contribution to the Node.js observability ecosystem. It fills a specific niche—SQL query latency monitoring with minimal overhead—without attempting to be a comprehensive database performance platform. Teams already running SQL databases in production and concerned with query regressions will find the tool immediately applicable to their latency budgeting workflow.
Key Features
Multi-Driver Support
Integrates with postgres.js, raw queries, and Prisma without requiring database abstraction
Query Latency Thresholds
Flags individual queries that exceed configurable performance limits
Request-Scoped Budgets
Monitors cumulative query volume and duration within a single user request
Sampling Controls
Adjustable sampling rates keep observability costs minimal in production
EXPLAIN ANALYZE Integration
Enables deeper investigation of offending queries when needed
Use Cases
-
1
Latency-Sensitive Applications
Detects database performance regressions before they impact users
-
2
High-Traffic Systems
Sampling-first approach manages observability costs while surfacing meaningful regressions
-
3
Teams with Latency Budgets
Enforces systematic per-query and per-request performance guardrails
-
4
Node.js Production Environments
Provides query-level monitoring without requiring architectural restructuring
FAQ
What database drivers does queryd support? ▾
How does request-scoped query budgeting work? ▾
Can queryd integrate with existing monitoring systems? ▾
Does queryd add overhead to production? ▾
Pricing
Open-source project with no commercial licensing.
Tech Stack & Tags
Discussion (1)
Guys! this is actually quite useful, please check it out and lets improve this product together as its open-source
Join the conversation — sign up to comment.
Sign up free