pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Charles Gomes <charlesrg@outlook.com>
To: Ondrej Ivanič <ondrej.ivanic@gmail.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Performance on Bulk Insert to Partitioned Table
Date: Thu, 20 Dec 2012 17:59:18 -0500
Message-ID: <BLU002-W73F8F8D02096BD549F2809AB370@phx.gbl> (raw)
In-Reply-To: <CAM6mieLLD+WBx_NXubUihbDbHzb46tjxYWNWg_VgjV9omwOVcw@mail.gmail.com>
References: <BLU002-W2777115565E1CBCF867857AB370@phx.gbl>
	<CAM6mieLLD+WBx_NXubUihbDbHzb46tjxYWNWg_VgjV9omwOVcw@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

True, that's the same I feel, I will be looking to translate the trigger to C if I can find good examples, that should accelerate. 
Using rules would be totally bad as I'm partitioning daily and after one year having 365 lines of IF won't be fun to maintain.

----------------------------------------
> Date: Fri, 21 Dec 2012 09:50:49 +1100
> Subject: Re: [PERFORM] Performance on Bulk Insert to Partitioned Table
> From: ondrej.ivanic@gmail.com
> To: charlesrg@outlook.com
> CC: pgsql-performance@postgresql.org
>
> Hi,
>
> On 21 December 2012 04:29, Charles Gomes <charlesrg@outlook.com> wrote:
> > When I target the MASTER table on all the inserts and let
> > the trigger decide what partition to choose from it takes 4 hours.
> >
> > If I target the partitioned table directly during the
> > insert I can get 4 times better performance. It takes 1 hour.
>
> Yes, that's my experience as well. Triggers are the slowest.
> Performance of "DO INSTEAD" rule is close to direct inserts but rule
> setup is complex (each partition needs one):
>
> create or replace rule <master_table>_insert_<partition_name> as on
> insert to <master_table>
> where new.<part_column> >= ... and
> new.<part_column> < ....
> do instead
> insert into <master_table>_<partition_name>
> values (new.*)
>
> The best is used to direct inserts (into partition) if you can.
>
> --
> Ondrej Ivanic
> (http://www.linkedin.com/in/ondrejivanic)
>
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance 		 	   		  

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



view thread (48+ messages)  latest in thread

Message-ID: <BLU002-W73F8F8D02096BD549F2809AB370@phx.gbl>
Permalink:  ../BLU002-W73F8F8D02096BD549F2809AB370@phx.gbl/
Also on:    postgresql.org/message-id/BLU002-W73F8F8D02096BD549F2809AB370@phx.gbl

 · 

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-performance@postgresql.org
  Cc: charlesrg@outlook.com, ondrej.ivanic@gmail.com
  Subject: Re: Performance on Bulk Insert to Partitioned Table
  In-Reply-To: <BLU002-W73F8F8D02096BD549F2809AB370@phx.gbl>
  References: <BLU002-W2777115565E1CBCF867857AB370@phx.gbl> <CAM6mieLLD+WBx_NXubUihbDbHzb46tjxYWNWg_VgjV9omwOVcw@mail.gmail.com> <BLU002-W73F8F8D02096BD549F2809AB370@phx.gbl>

* 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