Re: Deciding which index to use - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Deciding which index to use
Date
Msg-id 18555.1415745078@sss.pgh.pa.us
Whole thread Raw
In response to Deciding which index to use  (Christophe Pettus <xof@thebuild.com>)
List pgsql-hackers
Christophe Pettus <xof@thebuild.com> 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



pgsql-hackers by date:

Previous
From: Christophe Pettus
Date:
Subject: Deciding which index to use
Next
From: Petr Jelinek
Date:
Subject: Re: Column/type dependency recording inconsistencies