X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 446A7D1C9C8 for ; Thu, 15 Apr 2004 04:08:47 -0300 (ADT) 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 85522-05 for ; Thu, 15 Apr 2004 04:08:46 -0300 (ADT) Received: from trade-india.com (unknown [61.16.154.82]) by svr1.postgresql.org (Postfix) with SMTP id 6E6D2D1C9BE for ; Thu, 15 Apr 2004 04:08:41 -0300 (ADT) Received: (qmail 11990 invoked from network); 15 Apr 2004 06:55:43 -0000 Received: from valium.trade-india-local.com (HELO trade-india.com) (192.168.0.72) by system66.trade-india-local.com with SMTP; 15 Apr 2004 06:55:43 -0000 Message-ID: <407E3563.6000408@trade-india.com> Date: Thu, 15 Apr 2004 12:40:27 +0530 From: Rajesh Kumar Mallah Organization: Infocom Network Limited User-Agent: Mozilla Thunderbird 0.5 (X11/20040208) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Richard Huxton Cc: Postgres Performance Subject: Re: select count(*) very slow on an already vacuumed table. References: <407D7A89.60508@trade-india.com> <200404142008.58533.dev@archonet.com> In-Reply-To: <200404142008.58533.dev@archonet.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/167 X-Sequence-Number: 6467 The problem is that i want to know if i need a Hardware upgrade at the moment. Eg i have another table rfis which contains ~ .6 million records. SELECT count(*) from rfis where sender_uid > 0; +--------+ | count | +--------+ | 564870 | +--------+ Time: 117560.635 ms Which is approximate 4804 records per second. Is it an acceptable performance on the hardware below: RAM: 2 GB DISKS: ultra160 , 10 K , 18 GB Processor: 2* 2.0 Ghz Xeon What kind of upgrades shoud be put on the server for it to become reasonable fast. Regds mallah. Richard Huxton wrote: >On Wednesday 14 April 2004 18:53, Rajesh Kumar Mallah wrote: > > >>Hi >>I have .5 million rows in a table. My problem is select count(*) takes >>ages. VACUUM FULL does not help. can anyone please tell me >>how to i enhance the performance of the setup. >> >> > > > >>SELECT count(*) from eyp_rfi; >> >> > >If this is the actual query you're running, and you need a guaranteed accurate >result, then you only have one option: write a trigger function to update a >table_count table with every insert/delete to eyp_rfi. > >There is loads of info on this (and why it isn't as simple as you might think) >in the archives. First though: >1. Is this the actual query, or just a representation? >2. Do you need an accurate figure or just something "near enough"? > > >