Skip to main content

EXPLAIN

The EXPLAIN statement displays information about how Turso executes a SQL statement. There are two forms: EXPLAIN shows the virtual machine bytecode, and EXPLAIN QUERY PLAN shows the high-level query execution strategy.

Syntax

EXPLAIN

The EXPLAIN prefix causes Turso to return the sequence of virtual machine (VDBE) opcodes that would be used to execute the statement, rather than executing the statement itself.

Output Columns

EXPLAIN QUERY PLAN

The EXPLAIN QUERY PLAN prefix provides a high-level description of the strategy the query optimizer chose for executing a statement. This output is more useful than raw EXPLAIN for understanding query performance.

Output Columns

Common Detail Messages

Examples

Comparing Query Plans

Join Order

Subqueries

See Also

  • ANALYZE for collecting statistics that improve query plans
  • CREATE INDEX for creating indexes to speed up queries