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 1t6yi5-00Gmg9-Ib for pgsql-general@arkaria.postgresql.org; Fri, 01 Nov 2024 20:57:34 +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 1t6yi3-00HYvv-0q for pgsql-general@arkaria.postgresql.org; Fri, 01 Nov 2024 20:57:31 +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 1t6yi1-00HYvn-Ma for pgsql-general@lists.postgresql.org; Fri, 01 Nov 2024 20:57:31 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t6yhu-0041Fs-ND for pgsql-general@lists.postgresql.org; Fri, 01 Nov 2024 20:57:28 +0000 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.stl.internal (Postfix) with ESMTP id 137D01140107; Fri, 1 Nov 2024 16:57:21 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Fri, 01 Nov 2024 16:57:21 -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:subject:subject:to:to; s=fm2; t=1730494640; x=1730581040; bh=3F7/UsZ50VpjLefIjynJDYIqGRRcCIbFwSuoyLybxI4=; b= l8MAviJPkBl8LOsS5ptDONcapTWD3BtVlXCm4ZAiID+wwggOAGpzhvPgpGEPevMb z6bhxLUz+LtcBrtvPsgohQsSE9juEnOgFMsOK42RYT6kgpJ469edqEIv6niG2iBy K/wB/iM0UT0zKLCmDEeoks1H0C003YASPJaQcHZ5mCJpeYcaksNUrDX1mHUdCBQP QO3JKWOoak+fZg7e3DhOTlnt/vNojMfaHCuO6XYsxXSpZhs1gsazc1W2XcNwzh9N O3MrPdPFRtCexMELrf9yY21jsuAqJ+mPNwIOSonCllAV7iLnBkuFlt5y5EpozWwW UhletT7vSCO27/ksKyoTrQ== 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:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1730494640; x=1730581040; bh=3 F7/UsZ50VpjLefIjynJDYIqGRRcCIbFwSuoyLybxI4=; b=Y8W2AGcCgW0lja/AZ hc1LDTRPvIkHLvsbdTkU8OidSNPxX5dpGftfitaeUnkOjuTDsO23yOgw5adM/90O Db30BaHr4zmXPXQqdX2gnw7e2ZnXl6j7YhVx8lcL0p8KtZbDw0MILFkuAxl8JdZF kIzAPDfl6+RRY0+5g/offu0hBNgey6SFpY67/pogzkhFQf22Yg2QwIV6gptteY2w S542LDM85sXNpz+ELMNKVe/mOs/siW1PPpP+RYLcWnn/O4Ay6NmiWOL6V5Lh5ovw lS9D4r05E5TwjGWLBWXxMvIs439z7PK+29Lv5ygwfF654tpynq2CQsEPyrpZhZLy EyxyQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdekledgudegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtvdej necuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepleegveekkeekueeigfdt veeileeuhfefudefteekjeffkeejueejheegheegkedtnecuffhomhgrihhnpehpohhsth hgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsg gprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehthhhivghm ohesghgvlhgrshhsvghnvgdqphhfvghruggvrdgsihiipdhrtghpthhtohepphhgshhqlh dqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 1 Nov 2024 16:57:20 -0400 (EDT) Message-ID: Date: Fri, 1 Nov 2024 13:57:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Plans for partitioning of inheriting tables To: Thiemo Kellner , PostgreSQL General References: <5757acdc-39ed-4642-a449-26e47b1bcf95@gelassene-pferde.biz> <20241101094106.Horde.TwPSs9YUgJ5v-_M-4ltwoeh@webmail.gelassene-pferde.biz> <14c1eb8c-a853-43b3-a1ea-b105bfd6c99b@aklaver.com> <20241101182110.Horde.P_w6KptTjJNeM1X9Asg5bE3@webmail.gelassene-pferde.biz> <6bc57377-52e1-496a-b9d6-4cd9dc84d92e@aklaver.com> <20241101201600.Horde.Br4fPP8BFAAwzFoMaM8_eJS@webmail.gelassene-pferde.biz> <666c82fe-be27-4f32-99ad-8952a56f2282@aklaver.com> <8791c3bf-6fff-4db4-a29e-2679d2de0960@gelassene-pferde.biz> Content-Language: en-US From: Adrian Klaver In-Reply-To: <8791c3bf-6fff-4db4-a29e-2679d2de0960@gelassene-pferde.biz> 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 11/1/24 13:47, Thiemo Kellner wrote: > It looks to me basically to be a "create table A as select * from B where false". No it more capable then that. CREATE TABLE AS is bare bones, you get the column names, types and data(or not) and that is it. CREATE TABLE LIKE has like_option which allows to transfer over more attributes of the table, for example defaults, constraints, indexes, etc. See https://www.postgresql.org/docs/current/sql-createtable.html LIKE source_table [ like_option ... ] > > 01.11.2024 20:38:15 Adrian Klaver : > >> On 11/1/24 12:16, thiemo@gelassene-pferde.biz wrote: >>> Thanks, I shall have a look into it. I was under the assumption the the create table like would create no more than a structural copy. >> >> Not sure what you mean by structural copy, but the table created by CREATE TABLE LIKE will not have any association with the table it was created from. >> >> https://www.postgresql.org/docs/current/sql-createtable.html >> >> "Unlike INHERITS, the new table and original table are completely decoupled after creation is complete. Changes to the original table will not be applied to the new table, and it is not possible to include data of the new table in scans of the original table." >> >>> Torsten Förtsch > escribió: >>> Thiemo, >>>> it looks to me like you are using inheritance just to make sure your SOURCES and TOPO_FILES tables have some common columns. If you are not actually querying the TEMPLATE_TECH table and expect to see all the rows from the other 2 tables in that one table combined, then you could use CREATE TABLE (LIKE ...) instead of inheritance. That way your "child" tables would become normal tables and you could use declarative partitioning on them. >>>> Even if you are querying the TEMPLATE_TECH table, you could still do that by turning the TEMPLATE_TECH table into a view which performs a UNION ALL over the other tables. >>> >> >> -- >> Adrian Klaver >> adrian.klaver@aklaver.com > > -- Adrian Klaver adrian.klaver@aklaver.com