X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 43DCC9DCA15 for ; Mon, 27 Mar 2006 14:05:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25980-05 for ; Mon, 27 Mar 2006 14:05:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smarty.gabriel.co.hu (smarty.gabriel.co.hu [195.70.37.16]) by postgresql.org (Postfix) with ESMTP id D3A029DC986 for ; Mon, 27 Mar 2006 14:05:22 -0400 (AST) Received: from localhost (smarty [127.0.0.1]) by smarty.gabriel.co.hu (Postfix) with ESMTP id 04C7E3E3BD for ; Mon, 27 Mar 2006 20:05:23 +0200 (CEST) Received: from smarty.gabriel.co.hu ([127.0.0.1]) by localhost (smarty [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 31608-07-2 for ; Mon, 27 Mar 2006 20:05:22 +0200 (CEST) Received: from [192.168.111.135] (customer-174.radio-net.hu [217.113.54.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smarty.gabriel.co.hu (Postfix) with ESMTP id D19BF2FFB7 for ; Mon, 27 Mar 2006 20:05:22 +0200 (CEST) Message-ID: <4428296B.9040505@i-logic.hu> Date: Mon, 27 Mar 2006 20:05:31 +0200 From: =?ISO-8859-1?Q?G=E1briel_=C1kos?= Organization: I-Logic Kft User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: count(*) performance References: <4427E9E8.9030806@i-logic.hu> <20060327134103.GI80726@pervasive.com> In-Reply-To: <20060327134103.GI80726@pervasive.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at gabriel.co.hu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.03 required=5 tests=[AWL=0.030] X-Spam-Score: 0.03 X-Spam-Level: X-Archive-Number: 200603/524 X-Sequence-Number: 17961 Jim C. Nasby wrote: > But in this case, I'd bet money that if it's taking 4 minutes something > else is wrong. Have you been vacuuming that table frequently enough? That gave me an idea. I thought that autovacuum is doing it right, but I issued a vacuum full analyze verbose , and it worked all the day. After that I've tweaked memory settings a bit too (more fsm_pages) Now: staging=# SELECT count(*) from infx.infx_product; count --------- 3284997 (1 row) Time: 1301.049 ms As I saw the output, the database was compressed to 10% of its size :) This table has quite big changes every 4 hour, let's see how it works. Maybe I'll have to issue full vacuums from cron regularly. > What's SELECT relpages FROM pg_class WHERE relname='tablename' show? This went to 10% as well, now it's around 156000 pages. Regards, Akos -- Üdvözlettel, Gábriel Ákos -=E-Mail :akos.gabriel@i-logic.hu|Web: http://www.i-logic.hu=- -=Tel/fax:+3612367353 |Mobil:+36209278894 =-