pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steinar H. Gunderson <sgunderson@bigfoot.com>
To: pgsql-performance@postgresql.org
Subject: Re: Why does a simple query not use an obvious index?
Date: Mon, 30 Aug 2004 18:02:28 +0200
Message-ID: <20040830160228.GB16847@uio.no> (raw)
In-Reply-To: <16093.1093817023@sss.pgh.pa.us>
References: <ENEIKKAEJOFHOIHMMOIDIEBMJCAA.jack.kerkhof@guest-tek.com>
	<1093804128.5493.22.camel@localhost.localdomain>
	<87fz65k5sq.fsf@stark.xeocode.com>
	<16093.1093817023@sss.pgh.pa.us>

On Sun, Aug 29, 2004 at 06:03:43PM -0400, Tom Lane wrote:
> The expression "now() - something" is not a constant, so the planner
> is faced with "timestampfield > unknownvalue".  Its default assumption
> about the number of rows that will match is much too high to make an
> indexscan look profitable (from memory, I think it guesses that about
> a third of the table will match...).

Out of curiosity, does the subselect query I presented earlier in the thread
count as "a constant"? It gives the correct query plan, but this could of
course just be correct by accident...

/* Steinar */
-- 
Homepage: http://www.sesse.net/



view thread (28+ messages)  latest in thread

Message-ID: <20040830160228.GB16847@uio.no>
Permalink:  ../20040830160228.GB16847@uio.no/
Also on:    postgresql.org/message-id/20040830160228.GB16847@uio.no

 · 

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: sgunderson@bigfoot.com
  Subject: Re: Why does a simple query not use an obvious index?
  In-Reply-To: <20040830160228.GB16847@uio.no>

* 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