ECO-CMP-PY-005 — N+1 database query pattern¶
- Category: Computation (CMP)
- Family: Python (PY)
- Layer: Code
- Tier: 2
- Severity: warning
- Tags: python, database, n+1
- Legacy ID: ECO-PY-005
Summary¶
Queries executed inside iteration multiply round trips and load.
Rationale¶
N+1 is a classic hidden multiplier for latency, cost, and carbon.
Impact¶
{
"confidence": 0.8,
"notes": "Often severe at scale.",
"type": "network"
}
Detection¶
{
"languages": [
"python"
],
"method": "hybrid"
}
Remediation¶
{
"guidance": "Use bulk queries, eager loading, or JOINs.",
"tradeoffs": "May increase memory use; tune carefully."
}
Ontology¶
{
"system_layers": [
"code"
]
}