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 C5BE6329E53 for ; Sun, 3 Oct 2004 00:21:05 +0100 (BST) 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 04698-03 for ; Sat, 2 Oct 2004 23:20:58 +0000 (GMT) Received: from fuji.krosing.net (217-159-136-226-dsl.kt.estpak.ee [217.159.136.226]) by svr1.postgresql.org (Postfix) with ESMTP id 69665329E7B for ; Sun, 3 Oct 2004 00:20:59 +0100 (BST) Received: from fuji.krosing.net (localhost [127.0.0.1]) by fuji.krosing.net (8.12.11/8.12.11) with ESMTP id i92NKnJ5005745; Sun, 3 Oct 2004 02:20:49 +0300 Received: (from hannu@localhost) by fuji.krosing.net (8.12.11/8.12.11/Submit) id i92NKgYf005744; Sun, 3 Oct 2004 02:20:42 +0300 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: inconsistent/weird index usage From: Hannu Krosing To: Tom Lane Cc: Josh Berkus , Dustin Sallings , pgsql-performance@postgresql.org In-Reply-To: <10775.1096648455@sss.pgh.pa.us> References: <6FA9AB99-1373-11D9-A87D-000A957659CC@spy.net> <9345.1096641526@sss.pgh.pa.us> <200410010929.36026.josh@agliodbs.com> <10775.1096648455@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1096759241.5508.2.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Sun, 03 Oct 2004 02:20:41 +0300 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: 200410/20 X-Sequence-Number: 8496 On R, 2004-10-01 at 19:34, Tom Lane wrote: > Josh Berkus writes: > >> Most of the problem here comes from the fact that "current_date - 7" > >> isn't reducible to a constant and so the planner is making bad guesses > >> about how much of each table will be scanned. > > > I thought this was fixed in 7.4. No? > > No. It's not fixed as of CVS tip either, although there was some talk > of doing something in time for 8.0. That's weird - my 7.4.2 databases did not consider (now()-'15 min'::interval) to be a constant whereas 7.4.5 does (i.e. it does use index scan on index on datetime column) Is this somehow different for date types ? -------------- Hannu