DEV Community

Estevez Ben Lajamin
Estevez Ben Lajamin

Posted on

Query Explain Type

ALL: This type indicates a full table scan where no index is used. It’s generally the slowest option since it scans the entire table.

index: This type represents a full index scan, meaning the entire index is scanned rather than just part of it. It's faster than a full table scan but can still be slow for large indexes.

range: Used for range queries, this type indicates that a range scan is being used on the index. It's more efficient than a full table scan for queries involving ranges.

ref: This type is used when a non-unique index is used to retrieve rows that match a single value or a set of values. It's more efficient than ALL or index for certain queries.

eq_ref: Indicates the use of a unique index where the query matches a single row. It’s very efficient for queries that involve unique indexes.

const: This type is optimized for queries using a primary key or unique index. It’s very fast as it typically returns at most one row.

unique_subquery: This type is used when a unique index is utilized within a subquery. It’s efficient for subqueries with unique constraints.

fulltext: This type shows that a full-text index is being used, which is optimized for text search operations.

primary: Indicates that the primary key index is being used, which is typically the most efficient method for primary key lookups.

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay