Re: Why does a simple query not use an obvious index? - Mailing list pgsql-performance

From Tom Lane
Subject Re: Why does a simple query not use an obvious index?
Date
Msg-id 11438.1093899600@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why does a simple query not use an obvious index?  (Greg Stark <gsstark@mit.edu>)
Responses Re: Why does a simple query not use an obvious index?
List pgsql-performance
Greg Stark <gsstark@mit.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

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: seqscan instead of index scan
Next
From: Greg Stark
Date:
Subject: Re: Why does a simple query not use an obvious index?