Re: partial index regarded more expensive

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tobias Brox <tobias(at)nordicbet(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: partial index regarded more expensive
Date: 2005-08-11 03:14:40
Message-ID: 17714.1123730080@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Tobias Brox <tobias(at)nordicbet(dot)com> writes:
> This query puzzles me:
> select * from game where game_end>'2005-07-30' and state in (3,4);
> ...
> Now, how can the planner believe the game_by_state-index to be better?

I suspect the problem has to do with lack of cross-column statistics.
The planner does not know that state=4 is correlated with game_end,
and it's probably coming up with some bogus guesses about the numbers
of index rows visited in each case. You haven't given enough info to
quantify this, though.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Chun Yit(Chronos) 2005-08-11 03:37:57 it is always delete temp table will slow down the postmaster?
Previous Message John A Meinel 2005-08-11 01:07:50 Re: Speedier count(*)