Code RoomIndex larger than table
HardPrep Room Coding #4990

Index larger than table

On-callDatabases & SQLAlgorithms & data structuresSenior–Staff~40 min

Postgres. A frequently-updated `sessions` table (every request bumps `last_seen`) has a btree index on `last_seen`. Lookups on that index have slowly degraded over months from 1 ms to 60 ms, and the index is now larger than the table itself. `pg_stat_user_indexes` shows heavy usage; autovacuum runs. Table row count is stable. CPU/IO fine. The column updated each request is the *indexed* one. Triage why the index keeps bloating and give the durable fix.

What a strong answer looks like

Stop the bleeding first (mitigate), then form hypotheses from real signals. Separate root cause from symptom, communicate status as you go, and close with what prevents a repeat.

0:00 of about 40 min
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.