Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jCmIm-0007pA-DS for pgsql-general@arkaria.postgresql.org; Fri, 13 Mar 2020 15:32:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jCmIj-0004l5-N0 for pgsql-general@arkaria.postgresql.org; Fri, 13 Mar 2020 15:32:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jCmIj-0004kx-1w for pgsql-general@lists.postgresql.org; Fri, 13 Mar 2020 15:32:41 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jCmIb-0001wV-OF for pgsql-general@lists.postgresql.org; Fri, 13 Mar 2020 15:32:39 +0000 Received: by mail-wm1-x342.google.com with SMTP id x3so8093989wmj.1 for ; Fri, 13 Mar 2020 08:32:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ocado.com; s=google; h=reply-to:subject:to:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=QyG7muWSOhls7jIQ2fppuzEPW6q9EUCRZFhpuYKpiKI=; b=bkrUetFVvYDMkXzIAHJFBlPI+b/pEwt8vFrO+IcbBuedpa83zoc8TnWf0H4uhB3Ykn MMQSegcao7r+a+gEtIr4fw0VDayRTwiDsSUhA2zEzEjVPrFafEDIb0oCkPPtjlDKWdrM bxQC9TVNSRVUgeqbgufmul4yYZUS2qwVM8hbH/znD0iYM8P60CizPO/YARiWyXNrey7H WEMs4qt/4sTjUW1LO63qw7rQ/3yOAXegKFdRPbv6U8Vc6A4iQ/Hv5fVN0ZVwdkruxyQj DjjuVokrfC2cBoP3Uu5O1mkwB+oRnhx0+uIGm4q2JXtsxOhLqz5uf+A6GATO7198rU+W uZOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language; bh=QyG7muWSOhls7jIQ2fppuzEPW6q9EUCRZFhpuYKpiKI=; b=eCoib3mR18zQJZ3UpUuZo432ebIq09YxXJo/m1kn7GwPRVyKmthevNmOG1SKW3E/9y PLZZVcb59VTIHLSh5oAgtClVQz3gYOXLvngbeNITEJWkVzaJ5dt66IZfNH/s4zvM4y33 WQ3v/F1P2IU98dUeXXg4bdfsbiT8vAaYde1QK3oeg/H7c3i6ROfuBoJFBe37TYwaiQk0 Octgfqdvc3TXsAu0ccLhulg41blOygEBmT4qRvAUcJet97rTdBsRnLEXl7cq744uJBYG /QNc+X7yHj+A2CYtdlbQXZ9c65rLpeMyImWEz6mEf2DKpMAeOx6qIfySUL3v/dx85B1N OK8A== X-Gm-Message-State: ANhLgQ3KXANZOaqqdf/pBwcmJq15iDaSH1/xLmgzOJy0pIDH7bOKxvCC bMF9Vlm2wEvsnEFEcqTUXGjuFJS1RYQFvL+aQG30tuU68R4SS8uZVtZSjEDtIEU2nqGxksX1CKJ FEPV3IooDorjXNWGihFDkJhcorPW42TlsvuyFYcBiOt7Js6aEdoLcivfEMPg62qsuusgw0v3pdH FqlZxpe7zQIP9b X-Google-Smtp-Source: ADFU+vtAgzEIm5rMESgwMJMa9g1+GmykBXzozcSJlAOYxqNCtH99vmG+Th5Mj66pylwFresHHpb7vA== X-Received: by 2002:a1c:418b:: with SMTP id o133mr11811915wma.165.1584113550573; Fri, 13 Mar 2020 08:32:30 -0700 (PDT) Received: from [10.62.12.18] ([91.206.1.124]) by smtp.gmail.com with ESMTPSA id b141sm18278339wme.2.2020.03.13.08.32.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Mar 2020 08:32:29 -0700 (PDT) Reply-To: f.venchiarutti@ocado.com Subject: Re: vacuum full doubled database size To: Ron , pgsql-general@lists.postgresql.org References: <87ee68cc208c4775bd422277291fbcaf@zuerich.ch> From: Fabio Ugo Venchiarutti Organization: Ocado Technology Message-ID: Date: Fri, 13 Mar 2020 15:32:29 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 13/03/2020 15:15, Ron wrote: > This is why I'd VACUUM FULL in a planned manner, one or two tables at a > time, and *locally* from crontab. That's not really viable on any remotely busy system: VACUUM FULL claims exclusive table locks, causing queries to hang (https://www.postgresql.org/docs/current/sql-vacuum.html#NOTES mentions this too). Tools like pg_repack can do some live shrinking. I've also had some success at reclaiming space without large scale locks by carefully crafting some atomic DELETE + INSERT in order to force tuples from the tail end into gaps at lower CTIDs (physical page address) that were made available by previous plain VACUUMs - regular VACUUM will clip data files if all the tuples beyond a given offset are dead. > > On 3/13/20 8:41 AM, Zwettler Markus (OIZ) wrote: >> >> We did a "vacuum full" on a database which had been interrupted by a >> network outage. >> >> We found the database size doubled afterwards. >> >> Autovacuum also found a lot of orphaned tables afterwards. >> >> The ophan temp objects went away after a cluster restart while the db >> size remained doubled. >> >> Any idea? >> >> Postgres 9.6.17 >> > > -- > Angular momentum makes the world go 'round. -- Regards Fabio Ugo Venchiarutti OSPCFC Network Engineering Dpt. Ocado Technology -- Notice: This email is confidential and may contain copyright material of members of the Ocado Group. Opinions and views expressed in this message may not necessarily reflect the opinions and views of the members of the Ocado Group. If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses. References to the "Ocado Group" are to Ocado Group plc (registered in England and Wales with number 7098618) and its subsidiary undertakings (as that expression is defined in the Companies Act 2006) from time to time. The registered office of Ocado Group plc is Buildings One & Two, Trident Place, Mosquito Way, Hatfield, Hertfordshire, AL10 9UL.