{
  "id": 10234532,
  "title": "How to catch a missing index in a test, when your test table has 20 rows.",
  "url": "https://urgent.news/2026/09/27/how-to-catch-a-missing-index-in-a-test-when-your-test-table-has-20",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-27T15:20:04.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/ldavidsm/how-to-catch-a-missing-index-in-a-test-when-your-test-table-has-20-rows-1oh2"
  },
  "original_language": "en",
  "account": "A bug exists in test suites that goes unnoticed. A lookup by email is added, and it functions correctly. Six months later, the table contains two million rows, and the lookup still lacks an index. Despite this, the tests continue to pass. The reason for the tests' success lies in the test database containing only twenty rows. The difference in time between four seconds for two million rows and four milliseconds for twenty rows is negligible. The most apparent solution is to examine the query plan. However, this approach also fails, and the reason behind its failure is more intriguing than the fix itself.",
  "summary": "Here is a bug that no test suite catches. Someone adds a lookup by email. It works. Six months later the table has two million rows, that lookup has no index, and the endpoint takes four seconds. The tests were green the whole time, because the test database had twenty rows and four seconds of two million rows is four milliseconds of twenty. The obvious fix is to assert on the query plan. That…",
  "key_points": [
    "Bug in test suite goes unnoticed",
    "Lookup by email functions correctly",
    "Test database with 20 rows hides index issue"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}