pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Mead <scottm@openscg.com>
To: John Scalia <jayknowsunix@gmail.com>
Cc: rammohan ganapavarapu <rammohanganap@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Partitions
Date: Thu, 9 Nov 2017 21:03:30 -0500
Message-ID: <4B91E005-F3DB-499A-A20C-C68AEDF3320D@openscg.com> (raw)
In-Reply-To: <D0905E2B-C734-498C-B138-77910CF6C33A@gmail.com>
References: <CALm_VjhFWgFcZkxZEE=8bGSxidfRf=UgAzXfkW4H62XPwhNikw@mail.gmail.com>
	<D0905E2B-C734-498C-B138-77910CF6C33A@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>



> On Nov 9, 2017, at 18:41, John Scalia <jayknowsunix@gmail.com> wrote:
> 
> Set up a trigger on insert to check for the existence of the partition table, then it could do the insert there or create the table if needed and insert. Look online. I know I’ve seen examples of this.

Be careful here, these solutions generally take a massive performance hit. The best method is the native pg_partman function. It includes a built-in scheduler so that you don’t need to rely on an external tool like cron. 



> —
> Jay
> 
> Sent from my iPad
> 
>> On Nov 9, 2017, at 6:28 PM, rammohan ganapavarapu <rammohanganap@gmail.com> wrote:
>> 
>> Hi,
>> 
>> I have a requirement to create monthly partitions in my db, i am trying to understand what is the best way to do it, i know i can run a cron job to check if partition exist and create if not at the starting of month. Any suggestions?
>> 
>> Thanks,
>> Ram
> 
> 
> -- 
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



view thread (8+ messages)

Message-ID: <4B91E005-F3DB-499A-A20C-C68AEDF3320D@openscg.com>
Permalink:  ../4B91E005-F3DB-499A-A20C-C68AEDF3320D@openscg.com/
Also on:    postgresql.org/message-id/4B91E005-F3DB-499A-A20C-C68AEDF3320D@openscg.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: scottm@openscg.com, jayknowsunix@gmail.com, rammohanganap@gmail.com
  Subject: Re: Partitions
  In-Reply-To: <4B91E005-F3DB-499A-A20C-C68AEDF3320D@openscg.com>
  References: <CALm_VjhFWgFcZkxZEE=8bGSxidfRf=UgAzXfkW4H62XPwhNikw@mail.gmail.com> <D0905E2B-C734-498C-B138-77910CF6C33A@gmail.com> <4B91E005-F3DB-499A-A20C-C68AEDF3320D@openscg.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox