Launched this week

n1scan
Find N+1 queries in Postgres, from your app or server logs
1 follower
Find N+1 queries in Postgres, from your app or server logs
1 follower
Each query of an N+1 is fast, so the slow query log never shows it. n1scan is a local proxy that watches your app's PostgreSQL traffic (or reads the server's logs in production) and flags N+1 loops in any language or ORM. It proves which query caused each loop, suggests the index from a read-only EXPLAIN and the fix in your ORM's terms, and fails CI only on new N+1s. Open source, one binary: npx n1scan demo




Free
Launch Team

Framer AI workflowsPut Framer’s Agent to work on your site
Promoted
Hi everyone! I built n1scan because N+1 queries never show up in slow query logs: each query is fast, there are just 50 of them in a loop. ORM-specific detectors only cover one framework, so I made a small local proxy that watches the PostgreSQL wire protocol and works with any language or ORM (tested with 13 clients, including Prisma, Drizzle, SQLAlchemy, Django and pgx).
A few things it does now that I'm happy with:
It proves which query caused a loop, by matching the loop's parameters to the rows the earlier query returned, instead of guessing.
For production, n1scan logs reads the Postgres server log (stderr, csvlog or jsonlog) and finds the same loops without a proxy.
In CI it keeps a baseline, so a project that already has N+1s only fails on new ones, and each finding comes with the fix in your ORM's terms.
Try it without a database: npx n1scan demo. It's open source (MIT), and the most useful feedback is a client, ORM or log format it gets wrong. Good first issues are open if you want to contribute: https://github.com/alex00010/n1scan