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.89) (envelope-from ) id 1hn4SL-0000S6-Au for pgsql-general@arkaria.postgresql.org; Mon, 15 Jul 2019 17:08:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hn4SJ-0008Ea-9e for pgsql-general@arkaria.postgresql.org; Mon, 15 Jul 2019 17:08:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hn4SH-0008ET-Ds for pgsql-general@lists.postgresql.org; Mon, 15 Jul 2019 17:08:03 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hn4SC-0006wv-1f for pgsql-general@postgresql.org; Mon, 15 Jul 2019 17:08:00 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 00B7522136; Mon, 15 Jul 2019 13:07:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 15 Jul 2019 13:07:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=l saQeODiMulq3a+szDdxacDIKGBBFN3GLUB1OIdwub4=; b=tF7VaWzP3oW0bCCJ0 RTmQ3gRMpWh2hNzpiHg4ccINpluF3L+UIwvuRWUliE7BiIr/bjKMbAOiUzNVs9rZ +VQm4/5Q7A0J43VdpLTTVtfARTscVarM2j95a6HPVCxAXlvkr1o71aQc4eOxD76S 79aK3HHYwdRQsacsbMOHJiBW8WqBqDUiRi6YDHhh1Lh+15I/Y1S+4+GRS8Px2leP Is1+5YA6isAHSideds4AbMYUYo1YBYo1XbH+oSP8Y9T57vmVq1PLu+LKFyIQt91u Eca5vlVIta7MEJG06SxJV6/XG6nctIrM4fpyEmOLHVIrifjQYlIBxTnQ5Vx6qjiK W6c9w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=lsaQeODiMulq3a+szDdxacDIKGBBFN3GLUB1OIdwu b4=; b=V/ymr2AdATy/tI4UPZzLgV/NwjIK3Yjt5N/cuVeUAFYXoBd3yMFO5SVNZ uhZNGrrCwqf8YT7V3sKkJUUwGzGBN3WqnwXaUgEaxVH+LJz3VHZqXpNoJ8i8EScS tqW8F2Df4PZWNfjf1DSM172noOKHrkEXK8p2U34YPICqDA6FeCQopZty/+0y546J kvMaSRV0g+lOQ/gMfjUjw9plHpqxftnIlbBfPxP1Xm8ED7Nxd29eZSa6eRAPBRmG 2301CNEATjIUN3GApI1nK2g6ht18Tvg4zANxUo4/VxEFicfTI0bV+Ckzhqs238QK kW7eDoNJqFmg2ge548Kip750iBMTA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrheekgddutdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucfkphephedtrdduleejrdektddrvdenucfrrghrrghmpehmrghilhhfrhhomhep rggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghruf hiiigvpedt X-ME-Proxy: Received: from ranger.suse (50-197-80-2-static.hfc.comcastbusiness.net [50.197.80.2]) by mail.messagingengine.com (Postfix) with ESMTPA id 160EC80060; Mon, 15 Jul 2019 13:07:51 -0400 (EDT) Subject: Re: after restore the size of the database is increased To: Luca Ferrari , pgsql-general References: From: Adrian Klaver Message-ID: Date: Mon, 15 Jul 2019 10:07:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 7/15/19 6:21 AM, Luca Ferrari wrote: > Hi all, > this should be trivial, but if I dump and restore the very same > database the restored one is bigger than the original one. > I did vacuumed the database foo, then dumped and restored into bar, > and the latter, even when vacuumed, remains bigger then the original > one. > No other activity was running on the cluster. > > What am I missing here? > > % vacuumdb --full foo > vacuumdb: vacuuming database "foo" > > % pg_dump -Fd -f backup_foo.d -U postgres foo > > % createdb bar > % pg_restore -Fd backup_foo.d -U postgres -d bar > > % psql -U postgres -c '\x' -c "SELECT pg_database_size( 'foo' ), > pg_database_size( 'bar' );" template1 > Expanded display is on. > -[ RECORD 1 ]----+----------- > pg_database_size | 2686571167 > pg_database_size | 2690212355 > > % vacuumdb --full bar > vacuumdb: vacuuming database "bar" > > % psql -U postgres -c '\x' -c "SELECT pg_database_size( 'foo' ), > pg_database_size( 'bar' );" template1 > Expanded display is on. > -[ RECORD 1 ]----+----------- > pg_database_size | 2686571167 > pg_database_size | 2688193183 What does \l+ show? > > % psql -c 'select version();' -U postgres template1 > > version > ----------------------------------------------------------------------------------------------------------------------------------------------------- > PostgreSQL 11.3 on amd64-portbld-freebsd12.0, compiled by FreeBSD > clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM > 6.0.1), 64-bit > (1 row) > > > > > -- Adrian Klaver adrian.klaver@aklaver.com