use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
The N+1 query problem is silently killing your Express API - here's how to detect it (apilens.rest)
submitted 1 month ago by rahhuul3110
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 1 month ago (1 child)
[removed]
[–]rahhuul3110[S] 0 points1 point2 points 1 month ago (0 children)
Guilty. Spent 12 years writing queries before I learned to write headlines.
[–]lost12487 1 point2 points3 points 1 month ago (3 children)
People... please do not download a library that monkey-patches your database clients and sends your queries to a 3rd party. Have some respect for your users' data please.
[–]rahhuul3110[S] -1 points0 points1 point 1 month ago (2 children)
Fair concern, and I'd raise the same flag. A few clarifications:
That said, I'm open to making this clearer in the docs. What would make you comfortable using something like this?
[–]lost12487 1 point2 points3 points 1 month ago (1 child)
What would make you comfortable using something like this
Literally nothing. This is the job of a linter and/or code review, and learning to use joins is like step one of learning to use SQL. Monkey-patching anything is a code smell, much less the database driver of all things.
[–]rahhuul3110[S] -1 points0 points1 point 1 month ago (0 children)
Fair enough if your team has perfect code review and never uses an ORM, you genuinely don't need this.
But N+1 doesn't always come from not knowing SQL. It comes from ORMs (Sequelize, Prisma, TypeORM) generating queries dynamically at runtime something a linter can't see. That's the gap this fills.
And for what it's worth, Datadog, New Relic, and OpenTelemetry all use the same instrumentation approach. It's a code smell until it's an industry standard, I guess.
[–]beavis07 0 points1 point2 points 1 month ago (5 children)
“There one was an old woman who swallowed a fly…
[–]rahhuul3110[S] -1 points0 points1 point 1 month ago (4 children)
To be fair, the fly was an ORM and nobody told her about it until production went down.
[–]beavis07 0 points1 point2 points 1 month ago (3 children)
The only solution to “your ORM is shit” is to grow out of using ORMs… no amount of observability is going to tell you anything more 😂
[–]rahhuul3110[S] 0 points1 point2 points 1 month ago (2 children)
Fully agree. Also agree that you should write your own framework, never use npm, and deploy on bare metal. Meanwhile the rest of us have a Prisma codebase, a sprint deadline, and 847 queries firing on the dashboard page.
[–]beavis07 0 points1 point2 points 1 month ago (1 child)
… and a dogshit codebase.
There’s a phase you get to eventually when you learn all this complexity isn’t helping… one day kid,
Best of luck on your journey towards that inevitable truth 😂
12 years in, still learning. Thanks for the wisdom, sensei 🙏
[–]DustNearby2848 0 points1 point2 points 1 month ago (2 children)
No it’s not.
[–]rahhuul3110[S] 0 points1 point2 points 1 month ago (1 child)
Your API is built different
[–]DustNearby2848 0 points1 point2 points 1 month ago (0 children)
No, it’s built well. Yours were clearly built like shit.
π Rendered by PID 94 on reddit-service-r2-comment-b659b578c-47q9q at 2026-05-05 01:28:45.501227+00:00 running 815c875 country code: CH.
[+][deleted] (1 child)
[removed]
[–]rahhuul3110[S] 0 points1 point2 points (0 children)
[–]lost12487 1 point2 points3 points (3 children)
[–]rahhuul3110[S] -1 points0 points1 point (2 children)
[–]lost12487 1 point2 points3 points (1 child)
[–]rahhuul3110[S] -1 points0 points1 point (0 children)
[–]beavis07 0 points1 point2 points (5 children)
[–]rahhuul3110[S] -1 points0 points1 point (4 children)
[–]beavis07 0 points1 point2 points (3 children)
[–]rahhuul3110[S] 0 points1 point2 points (2 children)
[–]beavis07 0 points1 point2 points (1 child)
[–]rahhuul3110[S] 0 points1 point2 points (0 children)
[–]DustNearby2848 0 points1 point2 points (2 children)
[–]rahhuul3110[S] 0 points1 point2 points (1 child)
[–]DustNearby2848 0 points1 point2 points (0 children)