JAEN

SQL

EXPLAIN

CautionQuery plan

EXPLAIN ANALYZE <query>;

Inspect the query plan to find why it's slow (e.g. full scans).

Examples

  • EXPLAIN ANALYZE SELECT * FROM orders WHERE uid=1;Plan with real timings

Syntax

EXPLAIN [ANALYZE] <query>;

Before you run it

ANALYZE actually executes the query.

Used when you see

Slow database queries
2
Check the slow query's planFull scans and huge row estimates are the warnings.
See the whole flow →

Related commands

The same reference, with no signal at all

Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).

Get it free on the App Store