FREE2026 Database Management Software Comparison|Independent, data-backed — no sales callGet the PDF →

Spotsaas logo
Free PDF · Database Management

Index & Query Optimization Checklist

The methodical pass a DBA runs to turn a slow query into a fast one — read the plan, fix the access path, and verify the win in production. Work it top to bottom and you stop guessing at indexes and start fixing the row that the planner is actually choking on.

  • Optimization workflow
  • Plan red flags and what they mean
  • Before you ship the index
★★★★★Trusted by 3,000+ buyers· built from 88 database management software tools· independent
PDF · FreeIndex & Query Optimization Checklist

Where should we send it? Free · arrives in seconds · no spam.

We email it to you — one-click unsubscribe anytime.

  1. 1Tell us where to send it

    Your name and work email — nothing more.

  2. 2Check your inbox

    Your checklist arrives in seconds, not days.

  3. 3Use it with your team

    Editable and ready to share — make it your own.

A peek inside

See exactly what you're getting

Free PDF
Spotsaas · 2026
Index & Query Optimization Checklist
Optimization workflow
Plan red flags and what they mean
Before you ship the index
Get the checklist

What it is

The Index & Query Optimization Checklist is the methodical pass a DBA runs to turn a slow query into a fast one — and to do it from evidence rather than guesswork. It is structured as a four-step workflow: find the real offenders, read the execution plan, fix the access path, and verify and clean up. Worked top to bottom, it stops you from guessing at indexes and points you at the specific node the planner is actually choking on. The promise is precision: you fix the row the engine is struggling with, not the one you assume is the problem.

Step one is about looking at the right queries. It pulls the top queries by total time — not just per-call time — from pg_stat_statements, Performance Schema, or Query Store, because a fast query called a million times can outweigh one slow report. It captures rows examined versus rows returned, since a high ratio is the classic fingerprint of a missing or unused index. Step two reads EXPLAIN (ANALYZE, BUFFERS) bottom-up to find the most expensive node — a sequential scan on a large table, a nested loop with a high loop count, or a sort spilling to disk — and checks estimated versus actual rows to spot stale statistics misleading the planner.

Step three fixes the access path with real technique: a composite index in the right column order (equality columns first, then range, then ORDER BY), a covering index that includes the selected columns so the engine skips the heap lookup, a partial index when queries always filter on the same predicate, and query rewrites that preserve SARGability. Step four verifies the win — re-running EXPLAIN ANALYZE to confirm the plan switched to an index scan, running ANALYZE so statistics reflect reality, and dropping redundant indexes that slow every write. A plan-red-flags table and a 'before you ship the index' Q&A round it out.

What it's used for

DBAs and backend engineers use this checklist to make database performance work disciplined and repeatable instead of a hunch-driven guessing game. The concrete jobs it does:

  • Finding the queries that actually matter — ranking by total execution time and mean time from pg_stat_statements, Performance Schema, or Query Store, and confirming a query is genuinely hot in production rather than a one-off.
  • Reading execution plans correctly — running EXPLAIN (ANALYZE, BUFFERS), reading bottom-up, and locating the most expensive node, whether a Seq Scan, a high-loop Nested Loop, or a Sort spilling to disk.
  • Diagnosing planner misbehavior — comparing estimated versus actual rows to catch stale statistics, and checking whether the index is used for the filter, the join, and the ORDER BY or only some of them.
  • Designing the right index — composite column order (equality, then range, then sort), covering indexes that include selected columns, and partial indexes for queries with a constant predicate.
  • Rewriting queries for index use — replacing OR with UNION ALL, killing leading-wildcard LIKE, and avoiding functions on the indexed column that break SARGability.
  • Verifying the improvement — re-running EXPLAIN ANALYZE to confirm the plan switched to an Index Scan or Index Only Scan and the time dropped, then running ANALYZE so estimates reflect reality.
  • Cleaning up — dropping redundant and unused indexes (idx_scan = 0) that slow every write and inflate storage, and confirming the new index did not evict a hotter one from the buffer cache.

Who uses it

Query optimization is where database performance is won or lost, so the checklist is written for the people who diagnose slow systems and decide what to index.

Database administrators (DBAs)They own the EXPLAIN ANALYZE diagnosis, the composite and covering index design, and the index hygiene — dropping unused indexes and keeping statistics current so the planner makes good choices.
Backend engineersThey rewrite the queries the checklist flags — restoring SARGability, replacing OR with UNION ALL, removing leading wildcards — since many wins come from the query, not just the index.
Performance and SRE engineersThey monitor p95/p99 latency and surface the high total-time queries, tying the checklist's offenders back to the user-facing slowness that prompted the investigation.
Data engineersThey apply the same workflow to analytical and reporting queries, where rows-examined-versus-returned ratios and sort spills dominate, and where covering indexes pay off heavily.
Tech leadsThey use the 'before you ship the index' questions to gate index additions, weighing read speedup against the write cost every index imposes on a busy table.

Context & good to know

The deepest pitfall in database performance work is optimizing by intuition — adding an index because a query 'feels' slow, without reading the plan. This checklist exists to replace that with evidence: read what the planner is doing, find the most expensive node, and fix that. Reading EXPLAIN (ANALYZE, BUFFERS) bottom-up and comparing estimated to actual rows is the single most valuable skill it teaches, because the gap between the two is usually the real story — stale statistics steering the planner into a bad plan.

Indexing is a trade-off, never a free win, and the checklist is honest about that. Every index is maintained on every INSERT, UPDATE, and DELETE, so on a write-heavy table a rarely-used index is a net loss. Column order matters: a composite index on (a, b) helps WHERE a and WHERE a AND b but not WHERE b alone. And redundancy is silent waste — adding (a, b) when (a, b, c) already exists is pure overhead because the planner can use the prefix. The 'before you ship' Q&A is built to catch exactly these mistakes.

SARGability — whether a predicate can use an index — is where query rewrites earn their keep. Wrapping an indexed column in a function, leading a LIKE with a wildcard, or forcing the planner to evaluate an OR across columns all block index use no matter how good the index is. The checklist pairs index design with query rewriting because the fastest index in the world cannot help a query written in a way the planner cannot exploit. This is consistent across PostgreSQL, MySQL, and Oracle Database, even where the tooling differs.

Spotsaas places this checklist in its database resources because query performance is one of the most tangible differences teams feel between database engines and how they are run. Whether a team is on PostgreSQL, MySQL, MariaDB, or Oracle Database, the workflow — find the offender, read the plan, fix the access path, verify — is the same, and having it written down turns ad-hoc firefighting into a repeatable engineering practice.

✓ Independent · vendors can't pay to rank

Built on verified data, not vendor spin

Every Spotsaas resource draws on the Spotsaas Score — a blend of verified review ratings, review volume, and feature depth across 88 database management software tools. Refreshed regularly; data as of June 2026.

FAQ

Questions, answered

How do you find which queries to optimize first?

Pull the top queries by total execution time — not just per-call time — from pg_stat_statements (PostgreSQL), Performance Schema (MySQL), or Query Store (SQL Server). A fast query run a million times can consume more total time than one slow report, so sort by both total_exec_time and mean_exec_time. Then confirm the query is genuinely hot in production, since optimizing a one-off wastes effort.

How do you read an execution plan?

Run EXPLAIN (ANALYZE, BUFFERS) and read it bottom-up, because leaf nodes execute first. Find the most expensive node — a sequential scan on a large table, a nested loop with a high loop count, or a sort or hash spilling to disk. Compare estimated versus actual rows: a large gap means stale statistics are misleading the planner, and running ANALYZE often fixes the plan on its own.

What is a covering index?

A covering index includes all the columns a query needs — both the filter and the selected columns, often via an INCLUDE clause — so the engine can answer the query entirely from the index without a lookup into the heap or clustered key. This produces an Index Only Scan and is one of the most effective optimizations for read-heavy queries.

What order should columns go in a composite index?

Put equality columns first, then range columns, then the ORDER BY column. A composite index on (a, b) supports WHERE a= and WHERE a= AND b= but not WHERE b= alone, so order by how the queries actually filter and sort, not alphabetically. Getting the order wrong means the planner cannot use the index for the query you built it for.

What is SARGability and why does it matter?

SARGable means a predicate can use an index. Wrapping an indexed column in a function, using a leading-wildcard LIKE ('%term'), or forcing an OR across columns all block index use no matter how good the index is. Rewriting the query to keep the indexed column bare — replacing OR with UNION ALL, removing the leading wildcard — restores the planner's ability to use the index.

Can adding too many indexes hurt performance?

Yes. Every index is maintained on every INSERT, UPDATE, and DELETE, so on a write-heavy table a rarely-used index slows every write and inflates storage. Redundant indexes are pure waste — adding (a, b) when (a, b, c) exists gives nothing because the planner uses the prefix. Drop unused indexes (where idx_scan = 0 in pg_stat_user_indexes) as part of cleanup.

How do you verify an index actually helped?

Re-run EXPLAIN (ANALYZE) and confirm the plan switched to an Index Scan or Index Only Scan and the execution time dropped. Run ANALYZE or UPDATE STATISTICS so the planner's row estimates reflect reality, and re-check the buffer cache hit ratio to ensure the new index did not push a hotter one out of memory. Verification in production is what separates a real win from a hopeful one.

What is an example of a database software with query-plan tooling?

PostgreSQL offers EXPLAIN ANALYZE and pg_stat_statements; MySQL has EXPLAIN and the Performance Schema; Oracle Database provides EXPLAIN PLAN, AWR, and SQL tuning advisors; and SQL Server has Query Store. The optimization workflow — find the offender, read the plan, fix the access path, verify — is the same across all of them even though the specific commands differ.

What does a high rows-examined-to-rows-returned ratio mean?

It is the classic sign of a missing or unused index. If the engine examines a million rows to return ten, it is scanning far more data than the query needs, usually because there is no index on the filter column or the existing index is not being used. The fix is typically an appropriate index plus a query rewrite to make the predicate SARGable.

Grow your pipeline with buyers who are already looking for you

254,000+ buyers use Spotsaas every month to evaluate and shortlist software. Get in front of them — for free, or with a managed growth plan built around your category.