pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tobias Brox <tobias@nordicbet.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: partial index regarded more expensive
Date: Wed, 10 Aug 2005 23:14:40 -0400
Message-ID: <17714.1123730080@sss.pgh.pa.us> (raw)
In-Reply-To: <20050810175208.GD6141@tobias.lan>
References: <20050810175208.GD6141@tobias.lan>

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



view thread (4+ messages)

Message-ID: <17714.1123730080@sss.pgh.pa.us>
Permalink:  ../17714.1123730080@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17714.1123730080@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tobias@nordicbet.com
  Subject: Re: partial index regarded more expensive
  In-Reply-To: <17714.1123730080@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox