How a single ORM query with deep nested includes brought down an entire CRM
A software team's CRM platform suffered a widespread outage shortly after onboarding a new customer whose unusually large data volume exposed a critical performance flaw. The culprit was a single Sequelize query on a deal-details endpoint that used deeply nested includes, generating a cascade of JOINs and follow-up queries that overwhelmed the database under real load. An initial response of raising the query timeout provided only temporary relief, allowing the slow query to run longer while the underlying problem remained. Engineers resolved the issue in two steps: splitting the bloated endpoint into several focused, paginated endpoints that returned only necessary columns, and adding indexes on foreign keys and filter columns used by child table lookups. The incident highlighted that in multi-tenant systems, one customer's data scale can degrade performance for all users sharing a connection pool, and that ORM convenience features like nested includes can be invisible at small scale but catastrophic at large scale.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in