X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 236155E46F4 for ; Mon, 30 Aug 2004 18:00:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42069-02 for ; Mon, 30 Aug 2004 21:00:03 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id CA6995E46F2 for ; Mon, 30 Aug 2004 18:00:01 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i7UL01jD011439; Mon, 30 Aug 2004 17:00:01 -0400 (EDT) To: Greg Stark Cc: Mr Pink , pgsql-performance@postgresql.org Subject: Re: Why does a simple query not use an obvious index? In-reply-to: <87ekloidls.fsf@stark.xeocode.com> References: <20040830073841.30957.qmail@web41108.mail.yahoo.com> <87ekloidls.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark message dated "30 Aug 2004 16:18:39 -0400" Date: Mon, 30 Aug 2004 17:00:00 -0400 Message-ID: <11438.1093899600@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/461 X-Sequence-Number: 8097 Greg Stark 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