Indexes trade storage and write cost for faster reads.
Section: Core concepts
What an index does
text
text
Index = extra data structure ordered by one or more keys so the engine can avoid scanning every row or document.Explanation
Use indexes on columns or fields that appear frequently in `WHERE`, `JOIN`, `ORDER BY`, and uniqueness checks.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Core concepts
Prefer high-selectivity columns
Columns with many distinct values tend to benefit more.
Remember the write cost
Every extra index must be maintained during inserts, updates, and deletes.
Composite index left-prefix rule
Use column order that matches real filter patterns.