From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Joe Conway <mail(at)joeconway(dot)com> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, Charles Gomes <charlesrg(at)outlook(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Writing Trigger Functions in C |
Date: | 2012-12-21 16:56:34 |
Message-ID: | CAFj8pRAah6yr_JPVnWBHHah54-05iJAJ6d=Cs-MBTLfHMMfpGQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2012/12/21 Joe Conway <mail(at)joeconway(dot)com>:
> On 12/21/2012 08:39 AM, Merlin Moncure wrote:
>> On Fri, Dec 21, 2012 at 10:25 AM, Charles Gomes <charlesrg(at)outlook(dot)com> wrote:
>>> Hello guys,
>>>
>>> I've been finding performance issues when using a trigger to modify inserts on a partitioned table.
>>> If using the trigger the total time goes from 1 Hour to 4 hours.
>>>
>>> The trigger is pretty simple:
>>>
>>> CREATE OR REPLACE FUNCTION quotes_insert_trigger()
>>> RETURNS trigger AS $$
>>> BEGIN
>>> EXECUTE 'INSERT INTO quotes_'|| to_char(new.received_time,'YYYY_MM_DD') ||' VALUES (($1).*)' USING NEW ;
>>> RETURN NULL;
>>> END;
>>> $$
>>> LANGUAGE plpgsql;
>>>
>>> I've seen that some of you guys have worked on writing triggers in C.
>>>
>>> Does anyone have had an experience writing a trigger for partitioning in C ?
>>>
>>> If you have some code to paste so I can start from I will really appreciate.
>>
>> Honestly I'd leave the trigger alone and modify the client code in
>> performance sensitive places to insert directly to the correct
>> partition table.
>
> I second that recommendation -- your performance will be much, much, better.
sure
Pavel
>
> Joe
>
> --
> Joe Conway
> credativ LLC: http://www.credativ.us
> Linux, PostgreSQL, and general Open Source
> Training, Service, Consulting, & 24x7 Support
>
>
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2012-12-21 17:12:50 | Re: Feature Request: pg_replication_master() |
Previous Message | Christopher Browne | 2012-12-21 16:56:25 | Re: Writing Trigger Functions in C |