Queries with timestamps - Mailing list pgsql-performance

From Arnau
Subject Queries with timestamps
Date
Msg-id 029701c3e04b$ea608930$3c0aa8c0@iberica.andromeiberica.com
Whole thread Raw
Responses Re: Queries with timestamps
List pgsql-performance
Hi all,

    I'm quite newbie in SQL and I have a performance problem. I have the
following table (with some extra fields) and without any index:

    CREATE TABLE STATISTICS
    (
        STATISTIC_ID             NUMERIC(10) NOT NULL DEFAULT
nextval('STATISTIC_ID_SEQ')
                                               CONSTRAINT pk_st_statistic_id
PRIMARY KEY,
        TIMESTAMP_IN          TIMESTAMP,
        VALUE                          NUMERIC(10)
    );

    The queries on this table are mainly related with the timestamp field,
e.g.:

        select * from statistics where time::date < current_date - interval
'1 month';

    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?

Thank you very much

--
Arnau



pgsql-performance by date:

Previous
From: Ron St-Pierre
Date:
Subject: ORDER BY and LIMIT with SubSelects
Next
From: Bruno Wolff III
Date:
Subject: Re: ORDER BY and LIMIT with SubSelects