Re: BUG #8598: Row count estimates of partial indexes

From: Claudio Freire <klaussfreire(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Marko Tiikkaja <marko(at)joh(dot)to>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8598: Row count estimates of partial indexes
Date: 2013-11-18 15:46:08
Message-ID: CAGTBQpb5GHCFUM0+AF7_=qKH5mYe3eZMkJLonDqMy-KTWDoFTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Nov 18, 2013 at 11:08 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Marko Tiikkaja <marko(at)joh(dot)to> writes:
>> On 11/17/13 9:18 PM, Tom Lane wrote:
>>> The long-term answer as far as Postgres is concerned is to learn about
>>> cross-column correlations, but that's not happening in the near future.
>
>> I'm completely clueless about how the planner works, but wouldn't it be
>> easier to have some kind of separate stats for the conditions in partial
>> indexes? It seems better in all cases than trying infer the stats from
>> cross-column correlations, even if we had that.
>
> There's been some discussion of providing a way to hint to ANALYZE about
> which combinations of columns are worth gathering cross-column statistics
> for. But partial index predicates seem like a pretty bad mechanism for
> that.
>
> regards, tom lane

Why?

If there's a partial index on some predicate, it does mean the
predicate is of common occurence or at least important and it's quite
expectable that more precise estimations regarding those queries
valuable.

Analyze should simply record the selectivity of partial index
predicates as it would the MFV of the boolean variable equal to the
predicate's result, and modifying the MFV estimation code to look up
for those specific stats doesn't seem too difficult.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dean Rasheed 2013-11-19 08:53:04 Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist
Previous Message steffen.hildebrandt 2013-11-18 14:19:45 BUG #8599: Wrong information in Documentation