Skip to content
Theory · Indexes and query plans · lesson 6 of 11

The composite index

Remember a paper phone book. People in it are sorted by last name, and within one last name by first name. You can find Peter Ivanov in seconds: open "Ivanov", then look for "Peter" inside. Finding all the Ivanovs is as fast: they stand together.

In this lesson

  • An index on two columns
  • The leading-column rule
  • Which column goes first
  • Common mistake
  • Key points