X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 4CE9D9FA5D8 for ; Wed, 14 Jun 2006 10:57:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 20543-01 for ; Wed, 14 Jun 2006 10:57:42 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 03BDA9F9CAA for ; Wed, 14 Jun 2006 10:57:42 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 521AE5643F; Wed, 14 Jun 2006 08:57:41 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Wed, 14 Jun 2006 08:57:40 -0500 Date: Wed, 14 Jun 2006 08:57:40 -0500 From: "Jim C. Nasby" To: Tom Lane Cc: Shaun Thomas , pgsql-performance@postgresql.org Subject: Re: Confirmation of bad query plan generated by 7.4 Message-ID: <20060614135740.GZ34196@pervasive.com> References: <9119.1150222168@sss.pgh.pa.us> <448EDFC4.8F27.00A9.0@leapfrogonline.com> <20060613211347.GB34196@pervasive.com> <10918.1150236282@sss.pgh.pa.us> <20060613223950.GK34196@pervasive.com> <18667.1150249849@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18667.1150249849@sss.pgh.pa.us> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060614:tgl@sss.pgh.pa.us::J+dOd7ipDqByX5wg:00000000000000000000 00000000000000000000000036zw X-Hashcash: 1:20:060614:sthomas@leapfrogonline.com::NO7CzU3ORfXjoJ+s:00000000000 0000000000000000000000002h0z X-Hashcash: 1:20:060614:pgsql-performance@postgresql.org::Tp2oFulSh7xs2xgE:00000 0000000000000000000000004EqG X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/247 X-Sequence-Number: 19604 On Tue, Jun 13, 2006 at 09:50:49PM -0400, Tom Lane wrote: > "Jim C. Nasby" writes: > > On Tue, Jun 13, 2006 at 06:04:42PM -0400, Tom Lane wrote: > >> It'd depend on the context, possibly, but it's easy to show that the > >> current planner does fold "now() - interval_constant" when making > >> estimates. Simple example: > > > Turns out the difference is between feeding a date vs a timestamp into the > > query... I would have thought that since date is a date that the WHERE clause > > would be casted to a date if it was a timestamptz, but I guess not... > > Hmm ... worksforme. Could you provide a complete test case? I can't provide the data I used for that, but I'll try and come up with something else. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461