Re: query with timestamp not using index - Mailing list pgsql-performance

From Brian Hirt
Subject Re: query with timestamp not using index
Date
Msg-id 9CFDF39A-43E5-11D9-AD0F-000D93AD2E74@mobygames.com
Whole thread Raw
In response to query with timestamp not using index  (Brian Hirt <bhirt@mobygames.com>)
Responses Re: query with timestamp not using index  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance

On Dec 1, 2004, at 1:06 PM, Tom Lane wrote:

<excerpt>

That seems like the hard way to express a timestamp constant.  Why not


</excerpt>

I realized after i sent this message that i might get this responese.
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 =
something_else;



    select blah from redir_log where redir_timestamp >=
foo_date::timestamp without time zone at time zone 'GMT';

    etc / etc / etc

end;


<excerpt>select count(*) from redir_log

where redir_timestamp >= '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


</excerpt><x-tad-smaller>--------------------------------------------

MobyGames

http://www.mobygames.com

The world's largest and most comprehensive 

gaming database project</x-tad-smaller>


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.
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 =
something_else;

    select blah from redir_log where redir_timestamp >=
foo_date::timestamp without time zone at time zone 'GMT';
    etc / etc / etc
end;

> select count(*) from redir_log
> where redir_timestamp >= '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 
gaming database project

pgsql-performance by date:

Previous
From: Richard Huxton
Date:
Subject: Re: query with timestamp not using index
Next
From: Tom Lane
Date:
Subject: Re: query with timestamp not using index