X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 42E283A49CF; Thu, 4 Nov 2004 23:09:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62463-02; Thu, 4 Nov 2004 23:09:06 +0000 (GMT) Received: from linuxworld.com.au (unknown [203.34.46.50]) by svr1.postgresql.org (Postfix) with ESMTP id 402273A49C7; Thu, 4 Nov 2004 23:09:06 +0000 (GMT) Received: from localhost (swm@localhost) by linuxworld.com.au (8.11.6/8.11.4) with ESMTP id iA4N95h10227; Fri, 5 Nov 2004 10:09:05 +1100 Date: Fri, 5 Nov 2004 10:09:05 +1100 (EST) From: Gavin Sherry To: "Marc G. Fournier" Cc: Justin Clift , Tom Lane , pgsql-hackers@postgresql.org Subject: Re: [pgsql-www] pg_autovacuum is nice ... but ... In-Reply-To: <20041104182322.D21566@ganymede.hub.org> Message-ID: References: <20041103155855.O82047@ganymede.hub.org> <41895BDA.1090903@postgresql.org> <20041103201625.S82047@ganymede.hub.org> <19430.1099533223@sss.pgh.pa.us> <418AA915.7010903@postgresql.org> <20041104182322.D21566@ganymede.hub.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/151 X-Sequence-Number: 60723 On Thu, 4 Nov 2004, Marc G. Fournier wrote: > > Moved to -hackers where this belongs :) > > On Fri, 5 Nov 2004, Justin Clift wrote: > > > Tom Lane wrote: > > > >> Yup. 20000 < 23072, so you're losing some proportion of FSM entries. > >> What's worse, the FSM relation table is maxed out (1000 = 1000) which > >> suggests that there are relations not being tracked at all; you have > >> no idea how much space is getting leaked in those. > >> > >> You can determine the number of relations potentially needing FSM > >> entries by > >> select count(*) from pg_class where relkind in ('r','i','t'); > >> --- sum over all databases in the cluster to get the right result. > >> > >> Once you've fixed max_fsm_relations, do vacuums in all databases, and > >> then vacuum verbose should give you a usable lower bound for > >> max_fsm_pages. > > > > Would making max_fsm_relations and max_fsm_pages dynamically update > > themselves whilst PostgreSQL runs be useful? Sounds like they're the > > kind of things that many people would receive maximum benefit if > > PostgreSQL altered these settings as needed itself. > > I'm not sure if I like this one too much ... but it would be nice if > something like this triggered a warning in the logs, maybe a feature of > pg_autovacuum itself? Without a bit of hacking, its hard to increase the size of the free space map dynamically. This is because the free space map resides in shared memory and its the reason why the FSM GUC vars can only be changed on postmaster restart -- because its at that time we can calculate how much shared memory we need (for caching, fsm, other global resources) and allocate it. I think a contrib script which ran through each database and generated some optimal FSM settings for a target database would be a good medium term solution. Thanks, Gavin