Deciding which index to use

Поиск
Список
Период
Сортировка
Искать

Deciding which index to use

От:
Christophe Pettus <xof@thebuild.com>
Дата:
Where in the optimizer code does PostgreSQL decide which of several possibly-matching partial indexes to use?
--
-- Christophe Pettus  xof@thebuild.com



Re: Deciding which index to use

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Christophe Pettus  writes:
> Where in the optimizer code does PostgreSQL decide which of several possibly-matching partial indexes to use?

It costs them all out and uses the cheapest.

If the cost estimates come out exactly the same, you get an arbitrary
choice (I think probably always the index with smallest OID, but that's
an implementation artifact rather than something that's done explicitly
anywhere).
		regards, tom lane


FAQ