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 1gcefy-0004XH-Jq for pgsql-general@arkaria.postgresql.org; Thu, 27 Dec 2018 23:02:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gcefx-0008Cu-4U for pgsql-general@arkaria.postgresql.org; Thu, 27 Dec 2018 23:02:49 +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 1gcefw-0008Cn-SS for pgsql-general@lists.postgresql.org; Thu, 27 Dec 2018 23:02:48 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gcefu-0008B9-SQ for pgsql-general@lists.postgresql.org; Thu, 27 Dec 2018 23:02:48 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B2BC021F3D; Thu, 27 Dec 2018 18:02:45 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 27 Dec 2018 18:02:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=AbPfS6UO5ytbxeoXp6cF2SmBFe8 K98EPQQqiUj5pZOE=; b=Ln0QIMCwDxrSP8FN6cbHyQJTBhPCzWS8OSXXx0Sfeo5 +VZCpbRjNb4t9hA5WLUqqHQXzrj+tDCo8jmzthYzgHz4F0OusEH13Zpi75GotKc+ 0U+f7PA/3acRCkXulMBzIGjHn6qbeMY7+DQvKgnB7aqcIcArB4W5EOQcnZ3DrHmK bKhc2liMeEdDr++SFjA9HYxBco8nRsBv7hsrLbScykzTQ3DslbELkZbCwVH/didb s1UcmOeOl1TJn8GqlCvzIWItJMA5XpFDgMt/cbTbZ8R/Poe2SIT2gldtORb83uDV +9nbtqz53uUrC2Ofrl5Xf9q5TAx1+otR5kiGT7jjs3w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm1; bh=AbPfS6 UO5ytbxeoXp6cF2SmBFe8K98EPQQqiUj5pZOE=; b=aOmdvp/Uh2aFeyOpZgZ/5b dvYaH+xalJe89QBbXmFWAZTTZxhwiEJrQUe0POkHanoweuaZOODuE9N3ETZ8ZghE gXGaShKiSvQruIe+JYZwujGm+vaHaaeCNyCuukEZLGkJkU5g+jsyo//n+zD4imZ6 GQEgplp52rDOqaScUkLuEM99/ubtuNRKMdSMWvkKvVBelWO+Rj6FSE2lmn1+k5QA 8vE3ZYLFZM3GZPqOFd5lyYMjDRuImexwq5q7C1+boVVigzG7PeEYZZ1t9wAFShzr B92zfqG+KnRu75qSpdHV7o2L/jeVU13hPaR9XAElxgVXzFJh7Ek21CoEey3+kV3g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrtdeggddtheculddtuddrgedtkedrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt udenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucfkphepiedurddvudehrddufeejrdduiedvnecurfgrrhgr mhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiinecuvehluh hsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id E5D7410107; Thu, 27 Dec 2018 18:02:43 -0500 (EST) Date: Fri, 28 Dec 2018 08:02:40 +0900 From: Michael Paquier To: Ravi Krishna Cc: pgsql-general@lists.postgresql.org Subject: Re: Question about unlogged to logged conversion Message-ID: <20181227230240.GC2196@paquier.xyz> References: <1545951134.1308620.1619555704.45725FCC@webmail.messagingengine.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7gGkHNMELEOhSGF6" Content-Disposition: inline In-Reply-To: <1545951134.1308620.1619555704.45725FCC@webmail.messagingengine.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --7gGkHNMELEOhSGF6 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 27, 2018 at 05:52:14PM -0500, Ravi Krishna wrote: > Unlogged tables are not stored in the catalog like a regular table. When > it is converted to a logged table , the entire operation is logged (goes > into wal logs) in one single transaction, blocking the entire table > during the process. IMO this makes unlogged -> logged workflow not a > right fit for large tables.=A0 In other products I have used, large tables > are set to unlogged mode before bulk load and then set back to normal > logged mode. If you are interested of how things happen at code level, you can grep for INIT_FORKNUM, which is the initial state of an unlogged table used when doing crash recovery. And while the main fork's data is never WAL-logged, this initial fork needs to be included in WAL. -- Michael --7gGkHNMELEOhSGF6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlwlWhAACgkQnvQgOdby QH1WnxAAqXLp5q7rhvZJuc0vbYbnRr/v5SyFZEvyTCMacbTZHYhaPuS9hcr6hvgM sU16g8PXdkIyn6+90VDUn37k5QX8N+aHZrtgHqyIn12v6p5z2ZC0EQlBTYO2WMtf XP7dr0iDEYHWsaKeuNdMKhr8GpT0PTlE0R7cb31QJ53Zry91UB2aRSlgGlZv/Au6 N13+QsJ/cOp7e9P6dAkXdbeOnF5scB+RSsbc0Lc5LdiOuDoPlL8cK3c9RnFsY8Yb c4kvV9HwUJMz//P0yZEgSaO90jkq5LXL7UPcPnHGxfAReLQ1AP61nkvqXv4pzZkx 5kPblwboGyEQwqr3LzVxPVlo0UC/qoTWWW21BPSNaVd/YlUGdjkECfHN478JIWCL BdKV+A6snNbZax3pnOSfTCM/PwPM0prCxITshBU0oNuklVjvpaFN7tkK1PYqUxhr o/ZeGIADWwwId0jHTM+QZ8g09Cb39LK9W2Wi5GDo4DLuk0T6/JYdMbu2Fqkh7Zbk R16748j5InK7VzOOcv8Ike+k8Aos9J5QrokZ7c8pmaEemopua1DOt0ktlEQamRQo 9D2N/69PNxDvWNAfIcGqGNceRxTf2n1Sq9Xg4NaICN/Ky9sgHxNFbjzsBH6ZDtfu jqy3T60yKcVqF0yFLSvn9ndXaHqZHuwXXoy0NV0rH5q1nPRTcTA= =FKG6 -----END PGP SIGNATURE----- --7gGkHNMELEOhSGF6--