pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tobias Brox <tobias@nordicbet.com>
To: kjelle@bingon.no
Cc: pgsql-performance@postgresql.org
Subject: Re: Too slow querying a table of 15 million records
Date: Tue, 28 Jun 2005 14:03:33 +0800
Message-ID: <20050628060333.GH7652@tobias.exoweb.net> (raw)
In-Reply-To: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net>
References: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net>

[kjelle@bingon.no - Tue at 08:33:58PM +0200]
> I use FreeBSD 4.11 with PostGreSQL 7.3.8.
(...)
> database=> explain select date_trunc('hour', time),count(*) as total from
> test where p1=53 and time > now() - interval '24 hours' group by
> date_trunc order by date_trunc ;

I haven't looked through all your email yet, but this phenomena have been up
at the list a couple of times.  Try replacing "now() - interval '24 hours'"
with a fixed time stamp, and see if it helps.

pg7 will plan the query without knowledge of what "now() - interval '24
hours'" will compute to.  This should be fixed in pg8.

-- 
Tobias Brox, +86-13521622905
Nordicbet, IT dept



view thread (6+ messages)  latest in thread

Message-ID: <20050628060333.GH7652@tobias.exoweb.net>
Permalink:  ../20050628060333.GH7652@tobias.exoweb.net/
Also on:    postgresql.org/message-id/20050628060333.GH7652@tobias.exoweb.net

 · 

reply

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: tobias@nordicbet.com, kjelle@bingon.no
  Subject: Re: Too slow querying a table of 15 million records
  In-Reply-To: <20050628060333.GH7652@tobias.exoweb.net>

* 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