Single-column index (B-Tree)
Built into the frameworkOpsLowBuild a sorted "directory" for one column (B-Tree is the most common directory structure), usable for equality, range, and sort queries.
Best forSingle columns that frequently appear in WHERE, JOIN, and ORDER BY, such as email and foreign key columns.
Avoid whenThe column has very low cardinality, the table is tiny, or the table is written far more than read.
ProsAlmost every database uses it by default, so it is the most general choice
Equality, ranges, sorting, and prefix matches all benefit from it
It is simple to create, and a slow query usually starts here
ConsEvery write has to maintain the index, which slows writes and uses disk
A low-cardinality column, such as gender, gains very little from it
A function applied to the column disables it, so you need a separate expression index
Composite index (multi-column index)
Built into the frameworkOpsLowCombine multiple columns into one index, suited to "several conditions always queried together", such as "a user's orders sorted by time descending".
Best forFixed multi-condition query patterns, such as list pages filtered and paginated "by user + time".
Avoid whenQuery conditions are all over the place with no fixed pattern; look at the slow query log first and do not pile on indexes blindly.
ProsOne index can handle both filtering and sorting at the same time
It is more efficient than a separate single-column index on every column
It often also covers queries that only use the leading columns
ConsColumn order matters, and the index is unused if the query misses the leftmost prefix
A wider index uses more space, and writes get slower as well
You need EXPLAIN before you know whether it is actually being used
Partial index / covering index
Built into the frameworkOpsLowA partial index builds a directory only for rows meeting a condition (such as indexing only "unpaid" orders); a covering index puts the queried columns into the directory too, so the query does not need to go back to the table for the original data.
Best forLarge tables where only a small part of the data is frequently queried (such as pending orders), or a hot query needing extreme optimization.
Avoid whenYou have not used EXPLAIN to prove a regular index is insufficient, or you use MySQL (partial indexes unavailable).
ProsA partial index is smaller, so that small slice of hot data is queried faster
A covering index lets the query return by reading only the index
Writes maintain only the rows that match the condition, so the overhead is smaller
ConsMySQL does not support partial indexes; the other databases do
If the query condition does not match the index condition, the index will not be used
A covering index has to store extra columns, and a query change means changing the index too
Full-text index
Built into the frameworkOpsLowAn index designed specifically for "searching text by words", able to search for keywords inside article content, which a regular B-Tree cannot do (LIKE '%word%' scans the whole table).
Best forLightweight "search articles or notes" features in blogs and internal admin tools, with modest data volume.
Avoid whenSearch is a core product feature and needs Chinese segmentation, typo correction, and complex ranking; consider a professional search engine then.
ProsSearching for keywords inside long text is much faster than LIKE
It comes with the database, so you do not install a separate search service
Results can be sorted by relevance, which is enough for light search
ConsChinese needs word segmentation, and the built-in result is often not good enough
Typo correction, synonyms, and highlighting are far behind a dedicated search engine
The syntax changes with the database, so changing databases means rewriting search