{
  "id": 11880747,
  "title": "We dropped 8 indexes and added 3 without a single production statistic",
  "url": "https://urgent.news/2026/10/04/we-dropped-8-indexes-and-added-3-without-a-single-production-statistic",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-04T08:13:54.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/daniel_pertu/we-dropped-8-indexes-and-added-3-without-a-single-production-statistic-6ma"
  },
  "original_language": "en",
  "account": "A recent database optimization effort in the application resulted in the removal of eight indexes and the addition of three, with no impact on production statistics. The changes were primarily driven by analyzing the application code and SQL queries, as no production query statistics were available. The primary goal was to identify and remove expensive reads and redundant indexes that were not being utilized by any queries in the codebase. The migration process dropped indexes that were either prefix-redundant, duplicates of implicit unique indexes, or unused by any query. The added indexes were designed to support ascending order for better performance when querying the most frequently accessed data. Additionally, the implementation addressed a Drizzle-specific issue where the $count function was emitting an unfiltered count(*) over the entire table without a filter, leading to slower performance. The changes also included updating the dashboard layout to use the id-keyed cached row instead of the email-keyed one, reducing the number of reads of the same row per render. Lastly, the analytics engine was enhanced with an optional preloadedSessions argument to fetch the necessary rows alongside its own response, eliminating the need for separate sequential fetches.",
  "summary": "A round of database work in our app fixed a handful of genuinely expensive reads and rationalised the indexes on the three hottest tables. Every finding came from reading application code and the SQL it generates, because pg_stat_statements was not enabled and there were no production query statistics to read at all. That worked better than it should have, and it is still the wrong way round. So…",
  "key_points": [
    "Eight indexes removed without affecting production statistics",
    "Three new indexes added to improve query performance",
    "Dashboard layout updated for more efficient data retrieval"
  ],
  "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."
}