Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WxZAM-0001EM-0X for pgsql-performance@arkaria.postgresql.org; Thu, 19 Jun 2014 10:01:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WxZAL-0008K1-05 for pgsql-performance@arkaria.postgresql.org; Thu, 19 Jun 2014 10:01:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WxZAK-0008Jq-1O for pgsql-performance@postgresql.org; Thu, 19 Jun 2014 10:01:56 +0000 Received: from smtp-out2.gransy.com ([77.78.126.49]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WxZAE-0001pM-W2 for pgsql-performance@postgresql.org; Thu, 19 Jun 2014 10:01:53 +0000 Received: from smtp-out.gransy.com (localhost [127.0.0.1]) by smtp-out2.gransy.com (Postfix) with ESMTP id 18FF53F0163 for ; Thu, 19 Jun 2014 12:01:49 +0200 (CEST) Received: from smtp.gransy.com (smtp.simplia.cz [77.78.126.20]) by smtp-out2.gransy.com (Postfix) with ESMTP id 76E7E3F0138; Thu, 19 Jun 2014 12:01:48 +0200 (CEST) Received: from sq.gransy.com (elizabeth.gransy.com [89.187.132.199]) (Authenticated sender: tv@fuzzy.cz) by smtp.gransy.com (Postfix) with ESMTPA id B348D19A0684; Thu, 19 Jun 2014 12:01:43 +0200 (CEST) Received: from 212.47.19.46 (SquirrelMail authenticated user tv@fuzzy.cz) by sq.gransy.com with HTTP; Thu, 19 Jun 2014 12:01:44 +0200 Message-ID: <0b23386aa250a031713067d46ec33edc.squirrel@sq.gransy.com> In-Reply-To: References: Date: Thu, 19 Jun 2014 12:01:44 +0200 Subject: Re: huge pgstat.stat file on PostgreSQL 8.3.24 From: "Tomas Vondra" To: "Huang, Suya" Cc: "Pavel Stehule" , "pgsql-performance@postgresql.org" User-Agent: SquirrelMail/1.4.22 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 19 Červen 2014, 7:35, Huang, Suya wrote: > From: Pavel Stehule [mailto:pavel.stehule@gmail.com] > Sent: Thursday, June 19, 2014 3:28 PM > To: Huang, Suya > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] huge pgstat.stat file on PostgreSQL 8.3.24 > > Hello > > The size of statfile is related to size of database objects in database. > Depends on PostgreSQL version this file can be one per database cluster or > one per database (from 9.3), > These statistics should by reset by call pg_stat_reset() > http://www.postgresql.org/docs/9.2/static/monitoring-stats.html > Autovacuum on large stat files has significant overhead - it can be > increasing by using new PostgreSQL (9.3) and by migration stat directory > to ramdisk - by setting stats_temp_directory to some dir on ramdisk (tmpfs > on Linux) > Regards > > Pavel > > 2014-06-19 6:38 GMT+02:00 Huang, Suya : > Hi group, >   > We’ve found huge pgstat.stat file on our production DB boxes, the size is > over 100MB. autovacuum is enabled. So my question would be: > 1.       What’s a reasonable size of pgstat.stat file, can it be > estimated? > 2.       What’s the safest way to reduce the file size to alleviate the IO > impact on disk? > 3.       If need to drop all statistics, would a “analyze DB” command > enough to eliminate the performance impact on queries? >   > Thanks, > Suya > > > > > Hi Pavel, > > our version is 8.3.24, not 9.3. I also want to know the impact caused by > run pg_stat_reset to application, is that able to be mitigated by doing an > analyze database command? Hi, I really doubt you're on 8.3.24. The last version in 8.3 branch is 8.3.23. Running pg_stat_reset has no impact on planning queries. There are two kinds of statistics - those used for planning are stored withing the database, not in pgstat.stat file and are not influenced by pg_stat_reset. The stats in pgstat.stat are 'runtime stats' used for monitoring etc. so you may see some distuption in your monitoring system. ANALYZE command has nothing to do with the stats in pgstat.stat. However, if you really have a pgstat.stat this large, this is only a temporary solution - it will grow back, possibly pretty quickly, depending on how often you access the objects. Another option is to move the file to a tmpfs (ramdisk) partition. It will eliminate the IO overhead, but it will consume more CPU (because it still needs to be processed, and IO is not the bottleneck anymore). The other thing is that you should really start thinking about upgrading to a supported version. 8.3 did not get updates for > 1 year (and won't). Tomas -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance