Re: [GENERAL] Partial indices... - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [GENERAL] Partial indices...
Date
Msg-id 27300.1065892319@sss.pgh.pa.us
Whole thread Raw
In response to Partial indices...  (Dmitry Tkach <dmitry@openratings.com>)
List pgsql-bugs
Martijn van Oosterhout <kleptog@svana.org> writes:
> That's very strange.

Not really.  In the dummy example, the two indexes are exactly the same
size and so there is no reason for the planner to prefer one over the
other.  (Note that the two plans have exactly the same estimated cost.)

In a real example, with appropriate statistics from VACUUM or ANALYZE,
the planner would tend to prefer the smaller index.

If we had code to suppress the extra evaluation of the partial-index
condition (which we do not) then possibly the planner would be able
to favor the partial index on the grounds of less computation per row.
I don't see any simple way to suppress those clauses early enough to
let that cost difference figure into planning, though.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Dmitry Tkach
Date:
Subject: Partial indices...
Next
From: Robert Creager
Date:
Subject: create temp table ... inherits