From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Charles Gomes <charlesrg(at)outlook(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Writing Trigger Functions in C |
Date: | 2012-12-21 16:40:08 |
Message-ID: | CAFj8pRCwK3_a7=ikvP_ptf2ibUwdi18g0bTLn+QPforg=szouw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
you can find lot of examples in PostgreSQL source code - see
postgresql/contrib/spi directory
and documentation http://www.postgresql.org/docs/9.0/static/trigger-example.html
Regards
Pavel Stehule
2012/12/21 Charles Gomes <charlesrg(at)outlook(dot)com>:
> 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.
>
> Thanks
>
> --
> 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 | Joel Jacobson | 2012-12-21 16:47:22 | Re: PL/PgSQL STRICT |
Previous Message | Merlin Moncure | 2012-12-21 16:39:50 | Re: Writing Trigger Functions in C |