Re: partial index regarded more expensive

From: Tom Lane
Subject: Re: partial index regarded more expensive
Date: ,
Msg-id: 17714.1123730080@sss.pgh.pa.us
(view: Whole thread, Raw)
In response to: partial index regarded more expensive  (Tobias Brox)
List: pgsql-performance

Tree view

partial index regarded more expensive  (Tobias Brox, )
 Re: partial index regarded more expensive  (PFC, )
  Re: partial index regarded more expensive  (Tobias Brox, )
 Re: partial index regarded more expensive  (Tom Lane, )

Tobias Brox <> 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:

From: Tino Wildenhain
Date:
Subject: Re: Speedier count(*)
From: Gavin Sherry
Date:
Subject: Re: Speedier count(*)