PERF001warningPro

n-plus-one-query

Database or API calls inside loops can cause N+1 performance issues

Applies to: Go, JavaScript, Python, Ruby, TypeScript

Why this matters

Making a database or API call inside a loop means you make one call for each item in the loop. For 100 items, that's 100 calls! It's much faster to fetch all the data you need in one call before the loop.

Catch it before it ships

pip install stablestack # or: npx stablestackstablestack # scans your project, PERF001 includedstablestack explain PERF001

PERF001 is part of the Pro rule set. See pricing — the free tier ships 24 checks with no signup.

False positive in your codebase? Suppress a single line with # noqa: PERF001