MySQL 8 · PostgreSQL

Slow Queries Dragging Every Page

Systematic slow-query optimization: find the queries that dominate latency, fix their plans and indexes, and lock the gains into monitoring.

Discuss your workload

Diagnosis context

Latency in production rarely comes from one rogue statement — it accumulates from a handful of queries whose plans quietly degraded as data grew. We rank statements by total response-time contribution, rewrite or re-index the top offenders, and prove each fix with plan comparison and measured latency, not vibes.

What the fix plan covers

Every intervention is reversible and measured.

01

Latency ranking

Total-time analysis across digests and logs so effort lands on the queries that own the p95.

02

Plan comparison

EXPLAIN ANALYZE before and after, with the delta recorded for every changed statement.

03

Index strategy

Composite and covering indexes designed from real predicate and join shapes.

04

Guardrail metrics

Thresholds wired into monitoring so regressions page you before users feel them.

Execution path

From live diagnosis to a measured, reversible fix.

  1. 01

    Collect digest and slow-log data over a representative window

  2. 02

    Rank queries by total latency contribution

  3. 03

    Fix plans and indexes for the top offenders on staging

  4. 04

    Measure and compare, then roll out

  5. 05

    Set latency guardrails in monitoring

Measured outcome

Your p95 latency drops to target with a written record of every query that changed and why.

Common Questions

What engineering teams ask before working with us.

Our MySQL sits at 100% CPU right now. How fast can you help?

Emergency engagements start with a live diagnostic session — processlist sampling, digest analysis, and parameter review. Stabilization typically lands within one engagement day, with the root cause documented and a monitoring hook to catch recurrence.

Can a large ALTER really run without downtime?

Yes, when the strategy matches the change. Instant DDL covers many column operations in MySQL 8; in-place operations fit others; and gh-ost or pt-online-schema-change handle the rest with throttling tied to replica lag. We classify every change before anyone runs it, then rehearse on a production-size replica.

We keep getting deadlocks on the same tables. Is this a code problem?

It is an ordering problem, and the fix usually spans both sides. We map the lock graph and specify the transaction re-sequencing your team applies — typically a small, single-commit change. Isolation levels and index design, which are database-side, do most of the heavy lifting.

Why is our JSON-heavy API so slow?

Because queries filtering or sorting on JSON paths scan without an index. The fix keeps your flexible schema: virtual generated columns over the hot paths, indexes on those columns, and predicate rewrites at the database layer. Your application continues reading the same JSON.

Work with Burj

Bring your worst database incident to Burj.

Tell us what is slow — CPU, queries, migrations, or cost — and we will scope the smallest safe fix.

Plan an engagement