Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sjYu2-001pE6-G5 for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Aug 2024 06:45:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sjYtz-00G5cB-HZ for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Aug 2024 06:45:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sjYty-00G5br-Mo for pgsql-hackers@lists.postgresql.org; Thu, 29 Aug 2024 06:45:03 +0000 Received: from fhigh3-smtp.messagingengine.com ([103.168.172.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sjYtv-0022fH-4p for pgsql-hackers@lists.postgresql.org; Thu, 29 Aug 2024 06:45:02 +0000 Received: from phl-compute-03.internal (phl-compute-03.nyi.internal [10.202.2.43]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 141361151B76; Thu, 29 Aug 2024 02:44:59 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Thu, 29 Aug 2024 02:44:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1724913899; x=1725000299; bh=QQ65Q5VmQF G4/EyyQCy3RR9rcvg3jsMX5IGrN6OehUc=; b=RwGIwggzSNPPzNktommGf6NL+8 bDJ5eKjxxD4M16KM+j+mtdehzjiTnpCKYKlplnXZYCG0AOLJZrZssM1N+z0C9Xd0 /n5CD9X2KZEeb15piPb/BdoiE16XyAammebn+ExWCkIK6Jib4kxzQcdRnmBMkPAM IiRENPoLq0CoWxqkYDYcAOIy8vyRAULUiGDC4+3ySchB1ssRf4CNMdocWD0AHHmx qnswz66PIrJL4p5Z5RR7uYcZEXN63yk27je2RttI+kbaJPGMmW/MyfBRYQCvRh7b o9i44sGCfFalJ7w/3ZMr1qLOYm4zpA1kJKEcZV6StPAavyRFpZ/7T4T1r0Iw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1724913899; x=1725000299; bh=QQ65Q5VmQFG4/EyyQCy3RR9rcvg3 jsMX5IGrN6OehUc=; b=a68z+NdIaeBF00k7fsxMnQbBFnjOBd8Fvw6Hcp96qfi7 Ivo0UaaE2RFpVUM9jSr1sc653IJUaaKmMT5kjtFT+E5byAhVvyoVUpUKsCsk8Jer 58mMxnFU2fDEnaTaM+5i0kdDHwvb+vAp8MZmdQCetgC38Vn12TYNkJonu6+4JZic hypDx1s0fQLSBfNK925V6B7uExSQcbDjZhcQe+YNqOzmt+SICZOKD47XVGqHX8Ya Nq2bAr5zy/H3jHPX+K3sH1J5D64qHllL4RUa9f+Cu5Uap4uQjq6M3JDrETY1Qa1w T7ZYz/Sj20QesFEoPM5ZMSf8HD/Bl6E5UbFnoQAipQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudeffedguddtkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenfghrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffk fhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrh cuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeet leeifedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedvjeenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghl sehprghquhhivghrrdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopehnrghthhgrnhgusghoshhsrghrthesghhmrghilhdrtghomhdp rhgtphhtthhopegurghvihgurdhgrdhjohhhnhhsthhonhesghhmrghilhdrtghomhdprh gtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhq lhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Aug 2024 02:44:57 -0400 (EDT) Date: Thu, 29 Aug 2024 15:44:45 +0900 From: Michael Paquier To: Nathan Bossart Cc: "David G. Johnston" , Postgres hackers Subject: Re: Partitioned tables and [un]loggedness Message-ID: References: <20240424202640.GB861150@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pIECJp+xGrn1xh1j" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --pIECJp+xGrn1xh1j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 27, 2024 at 04:01:58PM -0500, Nathan Bossart wrote: > I've been thinking about this thread some more, and I'm finding myself -0= =2E5 > for adding relpersistence inheritance for UNLOGGED. There are a few > reasons: >=20 > * Existing partitioned tables may be marked UNLOGGED, and after upgrade, > new partitions would be UNLOGGED unless the user discovers that they ne= ed > to begin specifying LOGGED or change the persistence of the partitioned > table. I've seen many problems with UNLOGGED over the years, so I am > wary about anything that might increase the probability of someone using > it accidentally. >=20 > * I don't think partitions inheriting persistence is necessarily intuitiv= e. > IIUC there's nothing stopping you from having a mix of LOGGED and > UNLOGGED partitions, so it's not clear to me why we should assume that > users want them to be the same by default. IMHO UNLOGGED is dangerous > enough that we really want users to unambiguously indicate that's what > they want. Okay. Thanks for sharing an opinion. > * Inheriting certain persistences (e.g., UNLOGGED) and not others (e.g., > TEMPORARY) seems confusing. Furthermore, if a partitioned table is > marked TEMPORARY, its partitions must also be marked TEMPORARY. There = is > no such restriction when a partitioned table is marked UNLOGGED. The reason for temporary tables is different though: we expect everything to be gone once the backend that created these relations is gone. If persistence cocktails were allowed, the worse thing that could happen would be to have a partitioned table that had temporary partitions; its catalog state can easily get broken depending on the DDLs issued on it. Valid partitioned index that should not be once the partitions are gone, for example, which would require more exit logic to flip states in pg_class, pg_index, etc. > My current thinking is that it would be better to disallow marking > partitioned tables as LOGGED/UNLOGGED and continue to have users explicit= ly > specify what they want for each partition. It'd still probably be good to > expand the documentation, but a clear ERROR when trying to set a > partitioned table as UNLOGGED would hopefully clue folks in. The addition of the new LOGGED keyword is not required if we limit ourselves to an error when defining UNLOGGED, so if we drop this proposal, let's also drop this part entirely and keep DefineRelation() simpler. Actually, is really issuing an error the best thing we can do after so many years allowing this grammar flavor to go through, even if it is perhaps accidental? relpersistence is marked correctly for partitioned tables, it's just useless. Expanding the documentation sounds fine to me, one way or the other, to tell what happens with partitioned tables. By the way, I was looking at this patch series, and still got annoyed with the code duplication with ALTER TABLE SET LOGGED/UNLOGGED, so I've done something about that for now. -- Michael --pIECJp+xGrn1xh1j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmbQGN0ACgkQnvQgOdby QH2B8w//aIC+WTxVSu8RVUcky6q6uh2+oDnTWZww0BoWqLaFDaphfcYisSwb2DTD TL3TNY4WhdADKfpruDTs5oULkypqSTXPmG3DcTtKpACrLE/k/BqdRL6YZRRqRYBv jeqyJR9ONxnJXO207E1ti4FVK4igWeUuGubzus2ROoOOOnokVm++Piuo0zIkdhqw fDY7YfuZoarEFVmeyBtbXHCQH4K6j5Ac8q9iZfOvwqls5oqrPqNE4vraKUt71oBe Sx1yJReA23PuckbcBEBrTBM1CduByIcuLdsrJwMRa8k0R918zAure2wHhar9pK5p fCdnenEEOwFb5uEpyoEm4NBupPxnh8Zn8I0UMgwGra2IHltJBwgTgFPDIykBHDKE OGUy7ef/6Nmpa1EAgE1KyoM0NI8jODjpGPvY83WoS0m0dkZhcHs/+AkFrcBhYt0M awB1FSQDxtOIpoR7KdeMMqZnB31pNcLR75gPKurrMKe7lgZU1dtGOBK+YS9Ibuai TcL0fcT//bRWAXRAdeVY7uugL3p1LtALpZCOOLhVLWrOECzv2++CLnoCk87SC5Gk qg3sFTuzTgozRvuKR7n9fDuaWRnCDPlld12iHL+7cLAFr5KhA8gNPB0dHmOOkrxD Zm3SZjGYWj9D3f1D4BpKQ2I7H9buH/0fpQaW4qsEZiBARdcn+V8= =FpM9 -----END PGP SIGNATURE----- --pIECJp+xGrn1xh1j--