From: Arnau Rebassa i Villalonga <arebassa@andromeiberica.com>
To: pgsql-performance@postgresql.org
Subject: Queries with timestamp, 2
Date: Fri, 23 Jan 2004 08:50:02 +0100
Message-ID: <009b01c3e185$8255d8f0$3c0aa8c0@iberica.andromeiberica.com> (raw)
Hi all,
First of all thanks to Josh and Richard for their replies. What I have
done to test
their indications is the following. I have created a new table identical to
STATISTICS,
and an index over the TIMESTAMP_IN field.
CREATE TABLE STATISTICS2
(
STATISTIC_ID NUMERIC(10) NOT NULL DEFAULT
NEXTVAL('STATISTIC_ID_SEQ')
CONSTRAINT pk_st_statistic2_id PRIMARY KEY,
TIMESTAMP_IN TIMESTAMP,
VALUE NUMERIC(10)
);
CREATE INDEX i_stats2_tin ON STATISTICS2(TIMESTAMP_IN);
After that I inserted the data from STATISTICS and vacuumed the DB:
INSERT INTO STATISTICS2 ( SELECT * FROM STATISTICS );
vacuumdb -f -z -d test
once the vacuum has finished I do the following query
explain analyze select * from statistics2 where timestamp_in <
to_timestamp( '20031201', 'YYYYMMDD' );
NOTICE: QUERY PLAN:
Seq Scan on statistics2 (cost=0.00..638.00 rows=9289 width=35) (actual
time=0.41..688.34 rows=27867 loops=1)
Total runtime: 730.82 msec
That query is not using the index. Anybody knows what I'm doing wrong?
Thank you very much
--
Arnau
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: arebassa@andromeiberica.com
Subject: Re: Queries with timestamp, 2
In-Reply-To: <009b01c3e185$8255d8f0$3c0aa8c0@iberica.andromeiberica.com>
References: <009b01c3e185$8255d8f0$3c0aa8c0@iberica.andromeiberica.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