Run EXPLAIN (ANALYZE, BUFFERS). Likely it’s scanning an index on workspace_id only, filtering out closed rows, and sorting all matches in memory/disk. Create a partial composite index: CREATE INDEX CONCURRENTLY idx_open_ws ON tickets (workspace_id, updated_at DESC) WHERE status = 'open'. Re-run EXPLAIN to verify Index Scan Backward/Forward with LIMIT 25 and tiny buffer reads.
Follow-up Interview Question · What if the user can also filter by arbitrary combinations of 5 optional columns?