Re: Table Partitioning

From: Graham Everton <e(dot)man(dot)33(at)outlook(dot)com>
To: "depesz(at)depesz(dot)com" <depesz(at)depesz(dot)com>, Keith Fiske <keith(dot)fiske(at)crunchydata(dot)com>
Cc: Anjul Tyagi <anjul(at)ibosstech-us(dot)com>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Table Partitioning
Date: 2021-01-19 15:00:41
Message-ID: DBAP191MB119391D291282C47F3260CBADBA30@DBAP191MB1193.EURP191.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Op 0

Get Outlook for Android<https://aka.ms/ghei36>

________________________________
From: Keith Fiske <keith(dot)fiske(at)crunchydata(dot)com>
Sent: Tuesday, January 19, 2021 1:32:34 PM
To: depesz(at)depesz(dot)com <depesz(at)depesz(dot)com>
Cc: Anjul Tyagi <anjul(at)ibosstech-us(dot)com>; pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Table Partitioning

On Tue, Jan 19, 2021 at 7:12 AM hubert depesz lubaczewski <depesz(at)depesz(dot)com<mailto:depesz(at)depesz(dot)com>> wrote:
On Tue, Jan 19, 2021 at 12:01:12PM +0000, Anjul Tyagi wrote:
> Can we handle that in DB side with trigger?

I don't think so. At least not easily.

You could make a function to do so, though.

Best regards,

depesz

As depesz said, a trigger is possible, but very tricky. I was never able to find a good trigger-based, solution to these kinds of updates for pg_partman myself. Thankfully support for updates that move data between child tables was added for native partitioning in PG11. I would highly suggest planning an upgrade to your major version of PG. Skip 11 and go right to 12 or 13. An upgrade would be arguably easier than trying to code this yourself. And the added features to native partitioning in 11 and above will make managing them far better in the long run.

--
Keith Fiske
Senior Database Engineer
Crunchy Data - http://crunchydata.com<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcrunchydata.com%2F&data=04%7C01%7C%7C6893d693bed546d5e45108d8bc7ec5f5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637466599961823043%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5JghvfbJWXdiBdNiq9vfKECJ6AVVF7O01QEUM1Nu7Is%3D&reserved=0>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message David G. Johnston 2021-01-19 15:11:45 Re: hot standby in Postgresql 12
Previous Message Keith Fiske 2021-01-19 13:32:34 Re: Table Partitioning