Masif Kadapa
← Back to work
00320252025 — Present

Query Performance, Tamed

EXPLAIN-first schema and query work that kept enterprise dashboards and workflows fast as data grew.

RoleAssociate Software Engineer · Peoplebox.ai
Timeline2025 — Present
StackMySQL · PostgreSQL · ActiveRecord · SQL · Indexing
Context

Enterprise customers put real orgs — hundreds of thousands of rows — through reviews, surveys, and dashboards. A query that is fine at a thousand rows is slow at a million.

The problem

Slow reports and page loads showed up as p95 spikes. The fix wasn't more servers — it was reading the query plan and aligning the schema with the access patterns.

How it was solved
  1. 01

    Read EXPLAIN before touching code — the database is the source of truth for what is slow.

  2. 02

    Designed composite indexes and schema changes around the actual query shapes.

  3. 03

    Rewrote ActiveRecord scopes and joins to match the schema instead of fighting it.

  4. 04

    Measured before and after against production data, not the happy path.

The detail worth mentioning
The query plan is the truth. Optimising SQL starts with reading what the database actually does — not guessing in the code.
Outcome

p95response time

flattened on million-row tables by index-backed, EXPLAIN-first query plans

  • Slow p95 paths returned to predictable, index-backed reads.
  • Schema and index decisions documented so the next engineer doesn't re-learn them.
  • A repeatable playbook: plan first, index second, code last.