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 BD38F5E46C0 for ; Mon, 16 Aug 2004 20:08:51 -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 95588-01 for ; Mon, 16 Aug 2004 23:08:43 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 36FE45E46CD for ; Mon, 16 Aug 2004 20:08:41 -0300 (ADT) Received: from [64.81.245.111] (account josh@agliodbs.com HELO temoku.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6097155; Mon, 16 Aug 2004 16:10:00 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Harmon S. Nine" Subject: Re: Timestamp-based indexing Date: Mon, 16 Aug 2004 16:09:13 -0700 User-Agent: KMail/1.6.2 Cc: pgsql-performance@postgresql.org References: <410519F6.5020806@netarx.com> In-Reply-To: <410519F6.5020806@netarx.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200408161609.13018.josh@agliodbs.com> 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/249 X-Sequence-Number: 7885 Harmon, > A "VACUUM FULL ANALYZE" is performed every 3 hours. The FULL part should not be necessary if you've set your max_fsm_pages high enough. > Given there are 10080 minutes per week, the planner could, properly > configured, estimate the number of rows returned by such a query to be: > > 10 min/ 10080 min * 400,000 = 0.001 * 400,000 = 400. The planner doesn't work that way. > monitor=# explain analyze select * from "eventtable" where timestamp > > CURRENT_TIMESTAMP - INTERVAL '10 minutes'; Hmmm. What verison of PostgreSQL are you running? I seem to remember an issue in one version with selecting comparisons against now(). What happens when you supply a constant instead of ( current_timestamp - interval '10 minutes' ) ? > Here's something strange. We try to disable sequential scans, but to no > avail. The estimated cost skyrockets, though: That's how "enable_*=false" works in most cases. -- --Josh Josh Berkus Aglio Database Solutions San Francisco