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 1qutND-0021ou-Me for pgsql-general@arkaria.postgresql.org; Mon, 23 Oct 2023 11:45:31 +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 1qutNA-008OH8-JU for pgsql-general@arkaria.postgresql.org; Mon, 23 Oct 2023 11:45:29 +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 1qutNA-008OGz-8e for pgsql-general@lists.postgresql.org; Mon, 23 Oct 2023 11:45:28 +0000 Received: from cloud.gatewaynet.com ([185.90.37.94]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qutN7-002FKJ-Fw for pgsql-general@lists.postgresql.org; Mon, 23 Oct 2023 11:45:28 +0000 Content-Type: multipart/alternative; boundary="------------60ShhoX71ZrwgrQjbK00jCYI" Message-ID: <2f106761-daa8-6b26-013e-884da25322c2@cloud.gatewaynet.com> Date: Mon, 23 Oct 2023 14:45:22 +0300 MIME-Version: 1.0 Content-Language: en-US To: pgsql-general@lists.postgresql.org From: Achilleas Mantzios - cloud Subject: PostgreSQL inheritance vs https://wiki.postgresql.org/wiki/Don%27t_Do_This List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------60ShhoX71ZrwgrQjbK00jCYI Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello All in the wiki above and specifically in this commit : https://wiki.postgresql.org/index.php?title=Don%27t_Do_This&type=revision&diff=33210&oldid=33082 someone added this section about inheritance : " Don't use table inheritance Don't use table inheritance . If you think you want to, use foreign keys instead. Why not? Table inheritance was a part of a fad wherein the database was closely coupled to object-oriented code. It turned out that coupling things that closely didn't actually produce the desired results. When should you? Never …almost. Now that table partitioning is done natively, that common use case for table inheritance has been replaced by a native feature that handles tuple routing, etc., without bespoke code. One of the very few exceptions would be temporal_tables extension if you are in a pinch and want to use that for row versioning in place of a lacking SQL 2011 support. Table inheritance will provide a small shortcut instead of using |UNION ALL| to get both historical as well as current rows. Even then you ought to be wary of caveats while working with parent table. " I believe this text is false on too many accounts. So, what's the consensus about Inheritance in PostgreSQL, I am going to give a talk on it in November and I wouldn't like to advertise/promote/teach something that the community has decided to abandon or drop. Actually I proposed several topics and they chose this one (Inheritance). --------------60ShhoX71ZrwgrQjbK00jCYI Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hello All

in the wiki above and specifically in this commit :

https://wiki.postgresql.org/index.php?title=Don%27t_Do_This&type=revision&diff=33210&oldid=33082

someone added this section about inheritance :

"

Don't use table inheritance

Don't use table inheritance. If you think you want to, use foreign keys instead.

Why not?

Table inheritance was a part of a fad wherein the database was closely coupled to object-oriented code. It turned out that coupling things that closely didn't actually produce the desired results.

When should you?

Never …almost. Now that table partitioning is done natively, that common use case for table inheritance has been replaced by a native feature that handles tuple routing, etc., without bespoke code.

One of the very few exceptions would be temporal_tables extension if you are in a pinch and want to use that for row versioning in place of a lacking SQL 2011 support. Table inheritance will provide a small shortcut instead of using UNION ALL to get both historical as well as current rows. Even then you ought to be wary of caveats while working with parent table.

"


I believe this text is false on too many accounts. So, what's the consensus about Inheritance in PostgreSQL, I am going to give a talk on it in November and I wouldn't like to advertise/promote/teach something that the community has decided to abandon or drop. Actually I proposed several topics and they chose this one (Inheritance).

--------------60ShhoX71ZrwgrQjbK00jCYI--