Re: [GENERAL] Partial indices...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Dmitry Tkach <dmitry(at)openratings(dot)com>, pgsql-bugs(at)postgresql(dot)org, pg_general <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Partial indices...
Date: 2003-10-11 17:11:59
Message-ID: 27300.1065892319@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

Martijn van Oosterhout <kleptog(at)svana(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Creager 2003-10-12 16:08:10 create temp table ... inherits
Previous Message Igor Shevchenko 2003-10-11 11:38:22

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2003-10-11 18:21:43 Re: Procedure for adding a column
Previous Message Tom Lane 2003-10-11 16:54:00 Re: log_duration and \timing times repeatably much higher than "Total runtime" from explain analyze