SyntaxStudy
Sign Up
MySQL Intermediate 4 min read

Index Types in MySQL

Index Types

MySQL supports several index types: B-Tree (default, for range queries), Hash (exact match only, MEMORY engine), Full-Text, and Spatial. Choosing the right type matters for performance.

Example
-- B-Tree index (default)
CREATE INDEX idx_email ON users (email);

-- Unique index
CREATE UNIQUE INDEX idx_username ON users (username);

-- Composite index
CREATE INDEX idx_status_date ON orders (status, created_at);
Pro Tip

Composite indexes work for queries that filter on the leftmost columns.