Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1phAHn-0004B0-Lj for pgsql-general@arkaria.postgresql.org; Tue, 28 Mar 2023 14:26:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1phAHm-00045a-D3 for pgsql-general@arkaria.postgresql.org; Tue, 28 Mar 2023 14:26:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1phAHm-000457-1h for pgsql-general@lists.postgresql.org; Tue, 28 Mar 2023 14:26:54 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1phAHj-0007O1-Ii for pgsql-general@lists.postgresql.org; Tue, 28 Mar 2023 14:26:53 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 1AD6A320082A; Tue, 28 Mar 2023 10:26:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 28 Mar 2023 10:26:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1680013608; x=1680100008; bh=473mTF+F2bly7/ze1RUSmGb4A6WwxSSCfSi UGUR/PEI=; b=qeSwB7eV4EVDeYyNfEHsjDq+x1CKKDJ6B+hOADgtLGHwHEvVk+s wG9e+ehFpyrTwbZIAOI9C9sw8ruUbkICuJU+viQ9gxHtbEKL6Fdy1UrSIdRGlnBS AhnptDrzPoBcsXRFyuQWcmPN3o7XcGmMU+7OfLYWJ3jFpE2PizKs/SKWeOz2d4V2 mmPPRi+TlNaiIIhKKDcSpOnshhNekExa9KCINixUV+zeTU8Ls9jDH5+IjBLri97W ufzC41fVnqJtGTjaFgNd/R0yzQPyez33jsAGrxaimeTo+2vnP7jTNAD43eIlqyKw 7BNJJXfqYe0GlXUf2lpA33gh3EP4WazM4+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1680013608; x= 1680100008; bh=473mTF+F2bly7/ze1RUSmGb4A6WwxSSCfSiUGUR/PEI=; b=v AMnxtPnVr2YUr+oCgmt9ZyWwhaJtZ2St4H8+A3BDwJIkuDBNHKBltPZmKrLAm1ec +LhIQzhiMOI58vABFC31orMzrc0nnsJ7/TmCG174OfiKj+MSz41inpLVW3TTyDza emyB9nGBZnVeC7vv+fm/ebGj3xfY7rbx9TFRtyuDB3v3Mqe78HqdHBgQbXj4Qs+b gJa3thphK40o1QpdUN8YiV0dNLsv/k7O8XBWBV4C518ZwkfmwcOjK/NhCJNCVO7p N4FV+CQT+o9UpCCWzAuKNHTNvQ1RigKTCosiMEcDhOtw5LNqA99w1g4ftPAZ9NPH g10JCZH9zLJXO/iHe5XdQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehgedgjeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeelkeegjefhkeetheefudevteehiedvudehkeduleet fedvffeuhedtvdegtdeffeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Mar 2023 10:26:48 -0400 (EDT) Message-ID: <28cfc94c-f778-548d-1159-e33627e44eec@aklaver.com> Date: Tue, 28 Mar 2023 07:26:47 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: Cluster table based on grand parent? Content-Language: en-US To: Dominique Devienne , pgsql-general@lists.postgresql.org References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/28/23 06:17, Dominique Devienne wrote: > Hi again, > > Thanks for any insights. --DD > > PS: At this point, I don't even know how much cluster affects performance. >     But because it can affect the schema structure (by denormalizing), > i'd rather know early. You will need to explain to me how it denormalizes? It reorders rows by index definition and does not maintain that order over updates and inserts. > > [1]: https://www.postgresql.org/docs/current/sql-cluster.html > > > ``` > dd=> create table parent (id int generated always as identity primary > key, name text not null unique); > CREATE TABLE > > dd=> create table child (id int generated always as identity primary > key, parent int not null references parent(id) on delete cascade, name > text not null, unique(parent, name)); > CREATE TABLE > > dd=> create table grandchild (id int generated always as identity > primary key, parent int not null references child(id) on delete cascade, > name text not null, unique(parent, name)); > CREATE TABLE > ``` -- Adrian Klaver adrian.klaver@aklaver.com