Re: partial unique index and the planner

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michal Politowski <mpol+pg(at)meep(dot)pl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: partial unique index and the planner
Date: 2009-02-15 18:41:05
Message-ID: 23419.1234723265@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michal Politowski <mpol+pg(at)meep(dot)pl> writes:
> Is it normal that plans using a scan on a partial unique index
> estimate that much more than one row is returned?

There isn't currently any special logic to recognize that case;
the estimate is just whatever is going to come out of the normal
statistics-based estimation.

I'm unsure how hard it'd be to improve the situation. If we've already
identified relevant partial indexes before any of the stats code has to
run then it'd be pretty easy, but that might be a bit fragile.

Anyway, the usual advice for such cases is to see if raising the
statistics target helps.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stuart McGraw 2009-02-15 20:17:28 Running untrusted sql safely?
Previous Message Scott Marlowe 2009-02-15 18:28:45 Re: partial unique index and the planner