beginnerIndexes — Clustered, Non-Clustered, Composite, Covering

What is the leftmost prefix rule for composite indexes?

A composite index on (col_a, col_b, col_c) can only be used when the query filters include the leftmost columns in order. Supported: WHERE col_a = x (1st column). WHERE col_a = x AND col_b = y (1st and 2nd). WHERE col_a = x AND col_b = y AND col_c = z (all). NOT supported: WHERE col_b = y (skipping col_a). WHERE col_c = z (skipping col_a and col_b). Reason: the B-Tree is sorted first by col_a, the

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.

What is the leftmost prefix rule for composite indexes?

Next Step

Continue to When would you choose a partial index over a regular index?← Back to all SQL questions