Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 97DE84763FA for ; Wed, 8 Jan 2003 11:15:28 -0500 (EST) Received: from rs-pi.com (unknown [193.95.196.91]) by postgresql.org (Postfix) with ESMTP id F0182475E3E for ; Wed, 8 Jan 2003 11:15:13 -0500 (EST) Received: from spot (fw.rs-pi.com [193.95.196.154]) by rs-pi.com (Postfix) with SMTP id B2CE7AF40; Wed, 8 Jan 2003 17:21:07 +0100 (CET) Message-ID: <02b301c2b731$25d82d00$1100a8c0@rspi> From: "Nikola Ivacic" To: "Bruno Wolff III" Cc: References: <024d01c2b72f$a6a7dcc0$1100a8c0@rspi> <20030108162258.GA9033@wolff.to> Subject: Re: count(*) optimization Date: Wed, 8 Jan 2003 17:15:23 +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.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/102 X-Sequence-Number: 10967 The problem is in other software I use, witch uses count(*) function to display relation properties pgAdmin II phpPgAdmin Nikola ----- Original Message ----- From: "Bruno Wolff III" To: "Nikola Ivacic" Cc: Sent: Wednesday, January 08, 2003 5:22 PM Subject: Re: [SQL] count(*) optimization > On Wed, Jan 08, 2003 at 17:04:40 +0100, > Nikola Ivacic wrote: > > Hi > > > > I have trouble executing count(*) statement. > > On a large dataset it takes quite a while to return result. > > Is there any other way to get number of tupples in relation > > or is the only way to optimize count() function to index it? > > Indexes won't help count. > > If you retrieve counts a lot more than you do updates that will change their > value, then you may want to keep the counts in another table and use > triggers to keep them updated. >