X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1FAD3DAF8E for ; Wed, 26 Oct 2005 17:59:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89971-08 for ; Wed, 26 Oct 2005 20:59:43 +0000 (GMT) Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by svr1.postgresql.org (Postfix) with ESMTP id 3528ADAF87 for ; Wed, 26 Oct 2005 17:59:43 -0300 (ADT) Received: from archimedes ([172.16.2.68]) by mir3-fs.mir3.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 26 Oct 2005 14:03:09 -0700 Subject: Re: browsing table with 2 million records From: Mark Lewis To: aurora Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Organization: MIR3, Inc. Date: Wed, 26 Oct 2005 13:59:44 -0700 Message-Id: <1130360385.1156.12.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-22) Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 26 Oct 2005 21:03:09.0552 (UTC) FILETIME=[AB53DF00:01C5DA70] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.038 required=5 tests=[AWL=0.038] X-Spam-Level: X-Archive-Number: 200510/391 X-Sequence-Number: 15159 Do you have an index on the date column? Can you post an EXPLAIN ANALYZE for the slow query? -- Mark Lewis On Wed, 2005-10-26 at 13:41 -0700, aurora wrote: > I am running Postgre 7.4 on FreeBSD. The main table have 2 million > record (we would like to do at least 10 mil or more). It is mainly a > FIFO structure with maybe 200,000 new records coming in each day that > displace the older records. > > We have a GUI that let user browser through the record page by page at > about 25 records a time. (Don't ask me why but we have to have this > GUI). This translates to something like > > select count(*) from table <-- to give feedback about the DB size > select * from table order by date limit 25 offset 0 > > Tables seems properly indexed, with vacuum and analyze ran regularly. > Still this very basic SQLs takes up to a minute run. > > I read some recent messages that select count(*) would need a table > scan for Postgre. That's disappointing. But I can accept an > approximation if there are some way to do so. But how can I optimize > select * from table order by date limit x offset y? One minute > response time is not acceptable. > > Any help would be appriciated. > > Wy > >