X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 85A3DD1EA49 for ; Wed, 21 Jan 2004 18:50:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 08987-10 for ; Wed, 21 Jan 2004 14:50:22 -0400 (AST) Received: from smtp07.retemail.es (smtp07.auna.com [62.81.186.17]) by svr1.postgresql.org (Postfix) with ESMTP id 9CBAAD1EB68 for ; Wed, 21 Jan 2004 14:25:16 -0400 (AST) Received: from ariel ([62.57.108.228]) by smtp07.retemail.es (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with SMTP id <20040121182516.BYFS15006.smtp07.retemail.es@ariel> for ; Wed, 21 Jan 2004 19:25:16 +0100 Message-ID: <029701c3e04b$ea608930$3c0aa8c0@iberica.andromeiberica.com> From: "Arnau" To: Subject: Queries with timestamps Date: Wed, 21 Jan 2004 19:25:15 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.0 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: * X-Archive-Number: 200401/210 X-Sequence-Number: 5384 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