Re: partial unique index and the planner - Mailing list pgsql-general

From Tom Lane
Subject Re: partial unique index and the planner
Date
Msg-id 23419.1234723265@sss.pgh.pa.us
Whole thread Raw
In response to partial unique index and the planner  (Michal Politowski <mpol+pg@meep.pl>)
Responses Re: partial unique index and the planner
List pgsql-general
Michal Politowski <mpol+pg@meep.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

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: partial unique index and the planner
Next
From: Stuart McGraw
Date:
Subject: Running untrusted sql safely?