pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Andre Schubert <andre.schubert@km3.de>
To: pgsql-sql@postgresql.org
Subject: Re: Indexing timestamps
Date: Thu, 06 Jun 2002 09:02:21 -0700
Message-ID: <web-1501412@davinci.ethosmedia.com> (raw)
In-Reply-To: <20020606104521.3b3f1b06.andre.schubert@km3.de>

Andre,

I'm not even going to try to deal with the seq_scan vs. index_scan
issues on now().  This has been brought up in the list archives.  Test
your actual response times as well as the query plan; you may find that
you don't have a real problem.

Something I can help you with:

> explain select * from test_table where date_trunc('month',time_stamp)
> = date_trunc('month',datetime('2002-01-01'));
> NOTICE:  QUERY PLAN:
> 
> Seq Scan on test_table  (cost=0.00..2441.41 rows=584 width=16)

Try doing a:
CREATE INDEX idx_test_month ON test_table(extract(month FROM
time_stamp));

Which should help.

-Josh





view thread (7+ messages)  latest in thread

Message-ID: <web-1501412@davinci.ethosmedia.com>
Permalink:  ../web-1501412@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-1501412@davinci.ethosmedia.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-sql@postgresql.org
  Cc: josh@agliodbs.com, andre.schubert@km3.de
  Subject: Re: Indexing timestamps
  In-Reply-To: <web-1501412@davinci.ethosmedia.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