Re: partial index regarded more expensive - Mailing list pgsql-performance

From Tom Lane
Subject Re: partial index regarded more expensive
Date
Msg-id 17714.1123730080@sss.pgh.pa.us
Whole thread Raw
In response to partial index regarded more expensive  (Tobias Brox <tobias@nordicbet.com>)
List pgsql-performance
Tobias Brox <tobias@nordicbet.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

pgsql-performance by date:

Previous
From: John A Meinel
Date:
Subject: Re: Speedier count(*)
Next
From: "Chun Yit(Chronos)"
Date:
Subject: it is always delete temp table will slow down the postmaster?