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 0057852805 for ; Mon, 30 May 2005 14:58: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 87672-07 for ; Mon, 30 May 2005 17:58:07 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id ACCF552832 for ; Mon, 30 May 2005 14:58:05 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j4UHvsJQ024840; Mon, 30 May 2005 13:57:54 -0400 (EDT) To: Tobias Brox Cc: Michael Fuhr , pgsql-performance@postgresql.org Subject: Re: timestamp indexing In-reply-to: <20050530170816.GA9222@oppetid.no> References: <20050530091951.GO26100@tobias.exoweb.net> <20050530135429.GA78082@winnie.fuhr.org> <20050530170816.GA9222@oppetid.no> Comments: In-reply-to Tobias Brox message dated "Mon, 30 May 2005 19:08:16 +0200" Date: Mon, 30 May 2005 13:57:54 -0400 Message-ID: <24839.1117475874@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/442 X-Sequence-Number: 12606 Tobias Brox writes: >> What version of PostgreSQL are you using? > Also answered in my follow-up - "not yet pg8" :) Your followup hasn't shown up here yet, but if the query is written like WHERE timestampcol >= now() - interval 'something' then the pre-8.0 planner is not capable of making a good estimate of the selectivity of the WHERE clause. One solution is to fold the timestamp computation to a constant on the client side. regards, tom lane