Re: Trigger to create automated range partition table

From: Keith <keith(at)keithf4(dot)com>
To: bhanu1208(at)gmail(dot)com
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Trigger to create automated range partition table
Date: 2018-11-21 06:40:27
Message-ID: CAHw75vvsSCGxWSZMj0cBN-brVVwDZ-N1kvnZ7Bx=F-jpMNbP4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, Nov 20, 2018 at 10:42 PM bhanu prabhakar <bhanu1208(at)gmail(dot)com>
wrote:

> Hi friends,
>
> As a part of migration from Oracle to AWS Aurora postgress. I have
> converted the partition table using ora2pg tool.
>
> In Oracle we have feature of automated partition table creation when we
> insert the data, but in postgress 10.4 that feature is not enabled.
>
> Kindly help me and give some rough idea or example to create a trigger on
> table to create automated partition table when we insert the data.Thank you
>
> Bhanu P Murari.
>

It is not recommended that table creation for partitions be done via
triggers at this time unless the write level on the table is very, very
low. Since DDL is transactional in PostgreSQL, this can cause contention on
very active tables when that new child table is created.

I maintain an extension called pg_partman that can help with the automatic
pre-creation of child tables before they are needed for time & serial/id
based partition sets.

https://github.com/pgpartman/pg_partman

Keith
http://www.keithf4.com

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message legrand legrand 2018-11-21 08:09:57 Re: Trigger to create automated range partition table
Previous Message Achilleas Mantzios 2018-11-21 06:03:57 Re: PostgreSQL 10.5 : Logical replication timeout results in PANIC in pg_wal "No space left on device"