Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 792829FB4F8 for ; Tue, 8 May 2007 08:19:36 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 65546-08 for ; Tue, 8 May 2007 08:19:33 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by postgresql.org (Postfix) with ESMTP id 442A99FB59B for ; Tue, 8 May 2007 08:19:33 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so63846ugf for ; Tue, 08 May 2007 04:19:31 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=dapJZAFCjPGo0BbDvYVVwNn+tWGqSEmkT4/Hvl6HXhOpw251IGMULEhtV5yUhZPCUnXBaEGxAaRcMOqnTUK09eFRLNk3dPzZp0R7eAzgpmQFRV//clAouH1gD+DRx1Q+PgIDBeGFqXdlwjKdYh1qFaBjp4dQZ7ez6bcMbv+jBSw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=jGSQHX4Qopm2lePOEjY1qv729YgmznP3TvOUb15m/xGjjL+3Zygfb9ebNkS9UvA5AgnWxasrrBthcfdeUS2Di0iiakBlktejQ1hWt8OfFt3LkjjYWoJiGosZhrJfyu0Wz+VNTys3GCrb4y5/lF0Kd+R2ZoEuxoL5syDzBKrNfCI= Received: by 10.66.220.17 with SMTP id s17mr405794ugg.1178623171720; Tue, 08 May 2007 04:19:31 -0700 (PDT) Received: from ?172.24.32.83? ( [62.232.55.118]) by mx.google.com with ESMTP id q40sm642888ugc.2007.05.08.04.19.28; Tue, 08 May 2007 04:19:30 -0700 (PDT) Message-ID: <46405CAA.4030202@enterprisedb.com> Date: Tue, 08 May 2007 12:19:06 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: Guillaume Cottenceau CC: pgsql-performance@postgresql.org Subject: Re: truncate a table instead of vaccum full when count(*) is 0 References: <46404BEA.5060009@enterprisedb.com> <871whro9r4.fsf@meuh.mnc.lan> In-Reply-To: <871whro9r4.fsf@meuh.mnc.lan> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/111 X-Sequence-Number: 24501 Guillaume Cottenceau wrote: > Heikki, is there theoretical need for frequent VACUUM when > max_fsm_pages is large enough to hold references of dead rows? Not really, if you don't mind that your table with 10 rows takes hundreds of megabytes on disk. If max_fsm_pages is large enough, the table size will reach a steady state size and won't grow further. It depends on your scenario, it might be totally acceptable. > VACUUM documentation says: "tuples that are deleted or obsoleted > by an update are not physically removed from their table; they > remain present until a VACUUM is done". > > Free Space Map documentation says: "the shared free space map > tracks the locations of unused space in the database. An > undersized free space map may cause the database to consume > increasing amounts of disk space over time, because free space > that is not in the map cannot be re-used". > > I am not sure of the relationship between these two statements. > Are these deleted/obsoleted tuples stored in the FSM and actually > the occupied space is reused before a VACUUM is performed, or is > something else happening? Maybe the FSM is only storing a > reference to diskspages containing only dead rows, and that's the > difference I've been missing? FSM stores information on how much free space there is on each page. Deleted but not yet vacuumed tuples don't count as free space. If a page is full of dead tuples, it's not usable for inserting new tuples, and it's not recorded in the FSM. When vacuum runs, it physically removes tuples from the table and frees the space occupied by them. At the end it updates the FSM. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com