3 ms·
I'd normally agree, but this is dangerous advice. Why? Because by the time you notice, it's not slow, it's down. N+1 queries don't scale badly as a function of
by bastawhiz 3y ago
I'd normally agree, but this is dangerous advice. Why? Because by the time you notice, it's not slow, it's down. N+1 queries don't scale badly as a function of users, it scales badly as a function of cumulative user behavior. One unexpectedly active user can make you self-DoS your database. Even a DB proxy like pgbouncer won't really help because parameterized queries are likely implemented with stored procedures, which require an exclusive DB connection, layering bottlenecks on bottlenecks.
- SkyPuncher 3y agoIn my experience, you typically don’t just improve past slwo with n+1s. Sure, if you introduce an n+1 to a large, existing table it will slow down. However, most endpoints are going to start at zero.