Skip site navigation (1) Skip section navigation (2)

Re: Why does a simple query not use an obvious index?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Mr Pink <mr_pink_is_the_only_pro(at)yahoo(dot)com>,pgsql-performance(at)postgresql(dot)org
Subject: Re: Why does a simple query not use an obvious index?
Date: 2004-08-30 21:00:00
Message-ID: 11438.1093899600@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Greg Stark <gsstark(at)mit(dot)edu> writes:
> However I have the complementary reaction. I find peeking at the first
> bind parameter to be scary as hell. Functions seem slightly less scary.

FWIW, we only do it in the context of unnamed parameterized queries.
As the protocol docs say, those are optimized on the assumption that
they will be executed only once.  It seems entirely legitimate to me 
to use the parameter values in such a case.

We might in future get braver about using sample parameter values,
but 8.0 is conservative about it.

			regards, tom lane

In response to

Responses

pgsql-performance by date

Next:From: Greg StarkDate: 2004-08-31 06:00:22
Subject: Re: Why does a simple query not use an obvious index?
Previous:From: Tom LaneDate: 2004-08-30 20:48:05
Subject: Re: seqscan instead of index scan

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group