From: | Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com> |
---|---|
To: | Charles Gomes <charlesrg(at)outlook(dot)com> |
Cc: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Performance on Bulk Insert to Partitioned Table |
Date: | 2012-12-20 22:50:49 |
Message-ID: | CAM6mieLLD+WBx_NXubUihbDbHzb46tjxYWNWg_VgjV9omwOVcw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Hi,
On 21 December 2012 04:29, Charles Gomes <charlesrg(at)outlook(dot)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)
From | Date | Subject | |
---|---|---|---|
Next Message | Charles Gomes | 2012-12-20 22:56:24 | Re: Performance on Bulk Insert to Partitioned Table |
Previous Message | Charles Gomes | 2012-12-20 22:43:22 | Re: Performance on Bulk Insert to Partitioned Table |