X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2DEA3D1B4E3 for ; Fri, 3 Oct 2003 06:27:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 79990-04 for ; Fri, 3 Oct 2003 03:27:03 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 30503D1B53C for ; Fri, 3 Oct 2003 03:27:01 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h936UJrB011062 for ; Fri, 3 Oct 2003 12:00:19 +0530 Received: from persistent.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h936UIYM011036; Fri, 3 Oct 2003 12:00:18 +0530 Message-ID: <3F7D172E.3060107@persistent.co.in> Date: Fri, 03 Oct 2003 11:59:02 +0530 From: Shridhar Daithankar Organization: Persistent Systems Pvt. Ltd. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030917 Thunderbird/0.3a X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dror Matalon Cc: pgsql-performance@postgresql.org Subject: Re: count(*) slow on large tables References: <20031002191547.GZ87525@rlx11.zapatec.com> <20031002193905.GD18417@wolff.to> <3F7C98B8.C892D0E5@nsd.ca> <60brszcng5.fsf@dev6.int.libertyrms.info> <20031002223313.GE87525@rlx11.zapatec.com> <20031003042754.GH87525@rlx11.zapatec.com> In-Reply-To: <20031003042754.GH87525@rlx11.zapatec.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/79 X-Sequence-Number: 3827 Dror Matalon wrote: > I smell a religious war in the aii:-). > Can you go several days in a row without doing select count(*) on any > of your tables? > > I suspect that this is somewhat a domain specific issue. In some areas > you don't need to know the total number of rows in your tables, in > others you do. If I were you, I would have an autovacuum daemon running and rather than doing select count(*), I would look at stats generated by vacuums. They give approximate number of tuples and it should be good enough it is accurate within a percent. Just another approach of achieving same thing.. Don't be religious about running a qeury from SQL prompt. That's it.. Shridhar