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 1rzmAc-006ddK-TX for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Apr 2024 23:36:59 +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 1rzm9d-00110I-9l for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Apr 2024 23:35:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzm9c-001109-SB for pgsql-hackers@lists.postgresql.org; Wed, 24 Apr 2024 23:35:57 +0000 Received: from wfout8-smtp.messagingengine.com ([64.147.123.151]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzm9V-004UpH-VQ for pgsql-hackers@lists.postgresql.org; Wed, 24 Apr 2024 23:35:55 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfout.west.internal (Postfix) with ESMTP id 586631C0013F; Wed, 24 Apr 2024 19:35:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 24 Apr 2024 19:35:48 -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=fm3; t=1714001747; x=1714088147; bh=vDxVO5yY9K Li8b0wD0hn09heScCwVKLS1EfL9xgiWwc=; b=vaaSo9hdlQApl2UqzhQfGeNnzS opNA5BHWfYfRrKPZne1bOdpJtKIdD3796VdW4twhn+kKevoiF09Zx8rLe3gy9y9K BSosSBeNxm/SzWXcK7RLgsqgrX7bPjm6K4snSa7s08MG/C1bo7qb8Uy8rfKUJzSv HSlWzAiIj/NgqZRaZwEbNPhDH8Ortam2wEMQzr54PkA6IoBhatisTFiVomj2+qSe /GQC2mVv26uTDYtuqwOgaR9xOcXpOHTcxwiLv5unAMGgxh50YC6/pLHvW7UV3gex uiRvUc/9XNicqQ5m+9citn9XlZ1IIys/qpYmt+Ho+D7xZWijyb2TASYJdBXw== 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= fm3; t=1714001747; x=1714088147; bh=vDxVO5yY9KLi8b0wD0hn09heScCw VKLS1EfL9xgiWwc=; b=FpYKVTXT2u7BAWXAw6WfUJkeXqhQdWFz7zBeSpjM8gJp R2QDr0uAZdx936I2LpkuSFwQbnneyxtj6PDNdhU5Pb911ChhQoUchVJqstnerE1v 6VTPcv6ZTKNRqLAhxN+FM2KUpD4aR2NySb+FiAjcUytDEhIJWBn9xyzk5gXSR5tU BeWFn39kMRqz20CsIl/QY3ycsTbRxpbWVihtv7s6AxroBzxotYZQWsv3OddHCKY+ 70BSa4vwRZYH2G1r52k+n3P4m4K9xQasQzLRZel3YDVr+cd7sfJBFBObTrydKkZr iCr2J67oWXFW3Nz1sgz9wrnQ9Zc388nzuLoPv4PYZA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeliedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tdejnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepveetjefgjeevgedukeehieeu ieeuieevueeiudegheevuefggfduueelgeelieetnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 24 Apr 2024 19:35:45 -0400 (EDT) Date: Thu, 25 Apr 2024 08:35:32 +0900 From: Michael Paquier To: "David G. Johnston" Cc: Nathan Bossart , 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="rg420sDSK4adaLmO" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --rg420sDSK4adaLmO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 24, 2024 at 03:36:35PM -0700, David G. Johnston wrote: > On Wed, Apr 24, 2024 at 1:26=E2=80=AFPM Nathan Bossart > wrote: >> On Wed, Apr 24, 2024 at 04:17:44PM +0900, Michael Paquier wrote: >>> - CREATE TABLE PARTITION OF would make a new partition inherit the >>> logged ness of the parent if UNLOGGED is not directly specified. >> >> This one seems generally reasonable to me, provided it's properly noted = in >> the docs. >=20 > I don't see this being desirable at this point. And especially not by > itself. It is an error to not specify TEMP on the partition create table > command when the parent is temporary, and that one is a no-brainer for > having the persistence mode of the child be derived from the parent. The > current policy of requiring the persistence of the child to be explicitly > specified seems perfectly reasonable. Or, put differently, the specific > current persistence of the parent doesn't get copied or even considered > when creating children. I disagree here, actually. Temporary tables are a different beast because they require automated cleanup which would include interacting with the partitionining information if temp and non-temp relations are mixed. That's why the current restrictions are in place: you should be able to mix them. Mixing unlogged and logged is OK, they retain a state in their catalogs. > In any case we aren't going to be able to do exactly what it means by > marking a partitioned table unlogged - namely that we execute the truncate > command on it after a crash. Forcing the implementation here just so that > our existing decision to ignore unlogged on the parent table is, IMO, > letting optics corrupt good design. It depends on retention policies, for one. I could imagine an application where partitioning is used based on a key where we classify records based on their persistency, and one does not care about a portion of them, still would like some retention as long as the application is healthy. > I do agree with having an in-core way for the DBA to communicate that they > wish for partitions to be created with a known persistence unless the > create table command specifies something different. The way I would > approach this is to add something like the following to the syntax/system: >=20 > CREATE [ persistence_mode ] TABLE ... > ... > WITH (partition_default_persistence =3D { logged, unlogged, temporary }) = -- > storage_parameter, logged is effectively the default While we have keywords to drive that at query level for TEMP and UNLOGGED? Not sure to be on board with this idea. pg_dump may need some changes to reflect the loggedness across the partitions, now that I think about it even if there should be an ATTACH once the table is created to link it to its partitioned table. There should be no rewrites at restore. > I do agree with adding LOGGED to the list of optional persistence_mode > specifiers, possibly regardless of whether any of this happens. Seems > desirable to give our default mode a name. Yeah, at least it looks like Nathan and you are OK with this addition. -- Michael --rg420sDSK4adaLmO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmYpl0QACgkQnvQgOdby QH2CaA/9GCBT6BBalOlHRBdA41ouy+qcYEFvmtJUj2rkfqjVlcArffBHa9cDbWeP CBkuMNsmZ4o8UP3pvlDm97DcP1m2zcy1YEkvBzIMsm1h5xWwaHOizfqumfcBPUlK 5LIWsH1k9Sd17VF+WA4u9YrV1XY9E5H8GQWdL4EvzJi06Bvo49mZ472gqx2Fk5Ue bCO3i6StHutN3EEIcFMwdCGYKHEzXc0WhaHxvPTxgIpi3MPY/kuvTDPMw+Lg5dMq M7O89XWoOJXg6Fo0H1evxzfW0nBN3Rpq07yi+Dtmvhz/LGft0zKKhYKMJaNknY/S 1Y935FSLVTJh1WwGsJhnHQWmcZTUis8zUG19VwZLCQfBZtVZHExPotn6HceAv3Up yik1RXauXPN3MXqIA0sj/zcKUuzelkTWxDsLMv22tx/XsMN4aE+98VS/bo0nEoD5 DoOEVNWaK2Cp0jXBxM6+RWzPKzSQtQZkT+KXoA2QWZZC8cBmJYyyk0BBW/hxNxr+ nnzhmmd0oxAzlBz+U8ooq0m/zWRaCBT2Eb6DpTlRJ4IEIf9PZll50TTpdsD9ZUKM 0YnnnMXNV66Xl1dbFODbuI79k0rnz/kPsvD1b0QVUNurSB3u6SH9b9xNW0tq4GTq S17e+HE+wB/gmpv8Gv+VZrh0ANTLBipSJT6UzFj7VV8++4SShV8= =xQd1 -----END PGP SIGNATURE----- --rg420sDSK4adaLmO--