A component index is similar to a regular alphabetical index in a dictionary, but spans two or more letters, for example:
AA - page 1 AB - page 12
and etc.
Rows of the table are ordered first by the first column in the index, then the second, etc.
Used when searching on both columns OR on the first column. If your index looks like this:
AA - page 1 AB - page 12 β¦ AZ - page 245 BA - page 246 β¦
you can use it to search by 2 letters ( = 2 columns in the table) or as a simple index for a single letter:
A - page 1 B - page 246 β¦
Note that in the case of a dictionary, the pages themselves are sorted alphabetically. This is an example of a CLUSTERED index.
In the regular CLUSTERED index CLUSTERED links to pages are arranged, as in the history book:
Gaul, Alesia: pages 12, 56, 78 Gaul, Augustodonum Aeduorum: page 145 β¦ Gaul, Vellaunodunum: page 24 Egypt, Alexandria: pages 56, 194, 213, 234, 267
Composite indexes can also be used if you are ORDER BY two or more columns. In this case, the DESC clause may come in handy.
See this blog post about using the DESC clause in a composite index:
Quassnoi Apr 27 '09 at 20:24 2009-04-27 20:24
source share