pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Arnau <arnaulist@andromeiberica.com>
To: pgsql-performance@postgresql.org
Subject: Re: Queries with timestamps
Date: Wed, 21 Jan 2004 11:06:06 -0800
Message-ID: <200401211106.06506.josh@agliodbs.com> (raw)
In-Reply-To: <029701c3e04b$ea608930$3c0aa8c0@iberica.andromeiberica.com>
References: <029701c3e04b$ea608930$3c0aa8c0@iberica.andromeiberica.com>

Arnau,

>     As the number of rows grows the time needed to execute this query takes
> longer.  What'd I should do improve the performance of this query?

Tip #1)  add an index to the timestamp column
Tip #2) make sure that you VACUUM and ANALYZE regularly
Tip #3) You will get better performance if you pass the "current_date - 1 
month" as a constant from the client instead of in the query.   This is a 
known issue, expected to be fixed in 7.5.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




view thread (4+ messages)  latest in thread

Message-ID: <200401211106.06506.josh@agliodbs.com>
Permalink:  ../200401211106.06506.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200401211106.06506.josh@agliodbs.com

 · 

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: josh@agliodbs.com, arnaulist@andromeiberica.com
  Subject: Re: Queries with timestamps
  In-Reply-To: <200401211106.06506.josh@agliodbs.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