EXPLAIN, ANALYZE, and Verify Index Usage

Use EXPLAIN tools across PostgreSQL, MySQL, SQLite, and MongoDB to prove whether an index actually helps.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Cross-database tools

Different engines use different plan inspection commands.

PostgreSQL EXPLAIN ANALYZE

See actual runtime, loops, and buffer reads.

sqlANYpostgresqlexplainanalyze
sql
EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM users WHERE email = 'a@example.com';
Notes

This is often the first stop for PostgreSQL tuning.

MySQL EXPLAIN

Inspect access path and chosen key.

sqlANYmysqlexplain
sql
EXPLAIN SELECT * FROM users WHERE email = 'a@example.com';
Notes

Check the selected key, rows estimate, and extras such as filesort or temporary operations.

SQLite EXPLAIN QUERY PLAN

Inspect scans versus indexed searches.

sqlANYsqliteexplain-query-plan
sql
EXPLAIN QUERY PLAN SELECT * FROM users WHERE email = 'a@example.com';
Notes

Very useful in mobile, local, and embedded app debugging.

MongoDB executionStats

Check keys examined and docs examined.

javascriptANYmongodbexplain
javascript
db.users.find({ email: 'a@example.com' }).explain('executionStats')
Notes

A large drop in docs examined is a strong sign the index is paying off.

What good looks like

General signals that the index is helping.

Healthy plan signals

A quick review checklist after creating an index.

textANYchecklistverification
text
Look for:
- indexed search instead of full scan
- fewer rows/docs examined
- fewer extra sorts
- lower latency under realistic load
- acceptable write overhead
Notes

Do not stop at 'the index exists'. Confirm that it materially improves the real workload.

Recommended next

No recommendations yet.