Database · Medium
How do you order columns in a composite index? Explain the leftmost prefix rule.
DatabaseIndexingSenior
Answer preview
A composite (multi-column) index sorts rows by the first column, then the second within equal first values, and so on. Because of that ordering, it can only be used from the leftmost prefix inwards — (a, b, c) serves a, (a, b), and (a, b, c), but not b alone.…