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 467393A4DC1 for ; Wed, 1 Dec 2004 22:09:14 +0000 (GMT) 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 81814-08 for ; Wed, 1 Dec 2004 22:09:01 +0000 (GMT) Received: from homer.berkhirt.com (homer.berkhirt.com [207.88.49.100]) by svr1.postgresql.org (Postfix) with ESMTP id 8A26D3A549A for ; Wed, 1 Dec 2004 22:09:00 +0000 (GMT) Received: from [10.10.11.117] (homer [127.0.0.1]) (authenticated bits=0) by homer.berkhirt.com (8.12.10/8.12.10) with ESMTP id iB1M90F1012289; Wed, 1 Dec 2004 16:09:01 -0600 In-Reply-To: <18427.1101931618@sss.pgh.pa.us> References: <95241C28-43B8-11D9-AD0F-000D93AD2E74@mobygames.com> <18427.1101931618@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: multipart/alternative; boundary=Apple-Mail-24--922307065 Message-Id: <9CFDF39A-43E5-11D9-AD0F-000D93AD2E74@mobygames.com> Cc: "'Postgresql Performance'" From: Brian Hirt Subject: Re: query with timestamp not using index Date: Wed, 1 Dec 2004 15:09:04 -0700 To: Tom Lane X-Mailer: Apple Mail (2.619) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200412/21 X-Sequence-Number: 9396 --Apple-Mail-24--922307065 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed On Dec 1, 2004, at 1:06 PM, Tom Lane wrote: > > That seems like the hard way to express a timestamp constant. Why not > I realized after i sent this message that i might get this responese. =20= I should have mentioned this was from within a stored pl/pgsql=20 function, and the date wasn't a constant, but a variable. I was just=20 trying to simplify the example. it's more like: declare foo_date date; begin select some_date into foo_date from some_table where something =3D= =20 something_else; =09 select blah from redir_log where redir_timestamp >=3D=20 foo_date::timestamp without time zone at time zone 'GMT'; etc / etc / etc end; > select count(*) from redir_log > where redir_timestamp >=3D '10/14/2004 00:00 GMT'; > > (FWIW, though, the AT TIME ZONE construct *should* have been collapsed > to a constant; 8.0 fixes this.) > > regards, tom lane > -------------------------------------------- MobyGames http://www.mobygames.com The world's largest and most comprehensive=A0 gaming database project --Apple-Mail-24--922307065 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 On Dec 1, 2004, at 1:06 PM, Tom Lane wrote: That seems like the hard way to express a timestamp constant. Why not I realized after i sent this message that i might get this responese.=20 I should have mentioned this was from within a stored pl/pgsql function, and the date wasn't a constant, but a variable. I was just trying to simplify the example. it's more like: declare foo_date date; begin select some_date into foo_date from some_table where something =3D= something_else; =09 select blah from redir_log where redir_timestamp >=3D foo_date::timestamp without time zone at time zone 'GMT'; etc / etc / etc end; select count(*) from redir_log where redir_timestamp >=3D '10/14/2004 00:00 GMT'; (FWIW, though, the AT TIME ZONE construct *should* have been collapsed to a constant; 8.0 fixes this.) regards, tom lane -------------------------------------------- MobyGames http://www.mobygames.com The world's largest and most comprehensive=A0=20 gaming database project --Apple-Mail-24--922307065--