PDA

View Full Version : Point of combined indexes


bauhsoj
02-14-2008, 10:32 PM
What is the point of combined (multi-column) indexes and how can I best use them to speed up queries under different circumstances?

Fumigator
02-15-2008, 12:30 AM
A compound index is used to make a unique primary key on a table when it doesn't make any sense to create another column whose only purpose is to provide a unique primary key.

They are used just like any other index is used, but the order of the two columns matters. For example, a query that uses the second column in the index but not the first column will probably not use that index in the access path.