Re: Plans for partitioning of inheriting tables

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>, PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Plans for partitioning of inheriting tables
Date: 2024-10-31 16:57:06
Message-ID: d9d6a2f4-379b-45f3-9005-ab047625c1a4@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/25/24 11:47, Thiemo Kellner wrote:
>
> Am 25.10.2024 um 17:57 schrieb Adrian Klaver:
>>
>>> I do not feel it applies to my case. I tried to create a partitioned
>>> table that inherits columns from a base table. The documentation you
>>> provided the URL seems to speak of realising partitioning by using
>>> inheritance.
>>
>> This needs a code example to go any further.
>
> Sorry, my bad. I posted the URL of the table that is inherited from. The
> recepient is
> https://sourceforge.net/p/treintaytres/code/HEAD/tree/trunk/code_files/data_storage/PostgreSQL/tables/TOPO_FILES.pg_sqlcreate table if not exists TOPO_FILES (
>
> SOURCE_ID uuid
> constraint TOPO_FILES␟FK_01
> references SOURCES (ID)
> match full
> not null
> ,FILE_NAME text
> not null
> ,TILE raster
> not null
> ,FILE_CREATION_PIT timestamp(6) with time zone
> not null
> ,FILE_HASH text
> not null
> ,constraint TOPO_FILES␟PK primary key (ID)
> ,constraint TOPO_FILES␟UQ unique (SOURCE_ID
> ,FILE_NAME)
> )
> inherits(TEMPLATE_TECH);
> -- partition by hash (source_id); --NOTE Up to PG 17, partitioning with inheriting table is not possible.

It is just not the way you want to do it, see:

https://www.postgresql.org/docs/current/ddl-partitioning.html#DDL-PARTITIONING-USING-INHERITANCE

>
>
> The spender table ishttps://sourceforge.net/p/treintaytres/code/HEAD/tree/trunk/code_files/data_storage/PostgreSQL/tables/TEMPLATE_TECH.pg_sql
>
> create table if not exists TEMPLATE_TECH (
> ID uuid
> constraint TEMPLATE_TECH␟PK primary key
> not null
> default gen_random_uuid()
> ,ENTRY_PIT timestamp(6) with time zone
> not null
> default clock_timestamp()
> );
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Previous Message Rob Sargent 2024-10-31 16:13:03 Re: Index Partition Size Double of its Table Partition?