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 365FE5E46C2 for ; Sun, 29 Aug 2004 23:23:54 -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 11923-05 for ; Mon, 30 Aug 2004 02:23:52 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0A13C5E46F2 for ; Sun, 29 Aug 2004 23:23:50 -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 i7U2NuIH018967; Sun, 29 Aug 2004 22:23:56 -0400 (EDT) To: Mr Pink Cc: pgsql-performance@postgresql.org Subject: Re: Why does a simple query not use an obvious index? In-reply-to: <20040830020954.3596.qmail@web41110.mail.yahoo.com> References: <20040830020954.3596.qmail@web41110.mail.yahoo.com> Comments: In-reply-to Mr Pink message dated "Sun, 29 Aug 2004 19:09:54 -0700" Date: Sun, 29 Aug 2004 22:23:56 -0400 Message-ID: <18966.1093832636@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/438 X-Sequence-Number: 8074 Mr Pink writes: >>> AFAIK postgres doesn't peek at values used in a query when optimizing >> >> Of course it does. > But not ones returned by a function such as now(), or when you use > bind variables, as Tom aptly explained. FWIW, 8.0 does have the ability to use the values of bind variables for planning estimation (Oliver Jowett did the work for this). The main issue in the way of dealing with now() is that whatever we did to now() would apply to all functions marked "stable", and it's a bit nervous-making to assume that they should all be treated this way. Or we could introduce more function volatility categories, but that's not much fun either. regards, tom lane