Urgent.News

What's breaking now, across thousands of outlets.

Tech

We dropped 8 indexes and added 3 without a single production statistic

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…

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.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The brochure said 18 floors. The registration said 12.

This is a submission for the Sanity Challenge, Path One: Ship an Agent That Queries Real Content What I Built Let me introduce you to Ananya.

  • Nimbus Greens project claims 18 floors but registered building has 12 floors.
  • 2 BHK advertised as 1,050 sq ft in brochure, but only 690 sq ft registered.
  • Price difference of ₹4,50,000 due to parking allocation discrepancy.

Before you pay a stranger, write an acceptance test first

The leap nobody prices in You found someone who can do the thing. Their work looks good. Now you have to send money to a person you have never met, whose reputation you cannot check, whose claims you…

  • Acceptance test crucial before paying strangers for services
  • Limited first job with clear pass/fail criterion recommended
  • Seller completes small, honest rewrite by specified date

Our delete all my data button leaves one table alone, and the dialog says so

Two of the controls a privacy policy promises, export everything and delete everything, live in the same route file in our app. Neither is complicated.

  • Delete function excludes exercise attempts for AI scoring budget
  • Retains marker for review requests to reset account state
  • Policy retains assessment centre data until account deletion

Isolation Levels

Isolation Levels A deep-dive walkthrough of SQL transaction isolation levels — covering all five levels in precise, mechanical detail (Read Uncommitted, Read Committed, Repeatable Read, Serializable…

More from Sunday 4 October →