From: Kjell Tore Fossbakk <kjelltore@gmail.com>
To: Tobias Brox <tobias@nordicbet.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Querying 19million records very slowly
Date: Wed, 22 Jun 2005 10:18:30 +0200
Message-ID: <e79986c5050622011828dd4b41@mail.gmail.com> (raw)
In-Reply-To: <20050622080357.GW7839@tobias>
References: <e79986c505062112094f579a9b@mail.gmail.com>
<42B8719A.6040809@refractions.net>
<op.ssqot4d4th1vuj@localhost>
<e79986c505062200457fe97695@mail.gmail.com>
<20050622080357.GW7839@tobias>
Appreciate your time, Mr Brox.
I'll test the use of current_timestamp, rather than now(). I am not
sure if Pg can do a match between a fixed timestamp and a datetime?
time > current_timestamp - interval '24 hours',
when time is yyyy-mm-dd hh-mm-ss+02, like 2005-06-22 16:00:00+02.
If Pg cant do it, and current_time is faster, i could possibly convert
the time field in my database to timestamp, and insert all rows as
timestamp rather than a timedate. But that is some script to work over
19 mill rows, so I need to know if that will give me any more speed..
Kjell Tore.
On 6/22/05, Tobias Brox <tobias@nordicbet.com> wrote:
> [Kjell Tore Fossbakk - Wed at 09:45:22AM +0200]
> > database=> explain analyze select count(*) from test where p1=53 and
> > time > now() - interval '24 hours' ;
>
> Sorry to say that I have not followed the entire thread neither read the
> entire email I'm replying to, but I have a quick hint on this one (ref my
> earlier thread about timestamp indices) - the postgresql planner will
> generally behave smarter when using a fixed timestamp (typically generated
> by the app server) than logics based on now().
>
> One of my colleagues also claimed that he found the usage of
> localtimestamp faster than now().
>
> --
> Tobias Brox, +86-13521622905
> Nordicbet, IT dept
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: kjelltore@gmail.com, tobias@nordicbet.com
Subject: Re: Querying 19million records very slowly
In-Reply-To: <e79986c5050622011828dd4b41@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox