Re: Trigger performance

Поиск
Список
Период
Сортировка
От pginfo
Тема Re: Trigger performance
Дата
Msg-id 400FECD6.B835AF9C@t1.unisoftbg.com
обсуждение исходный текст
Ответ на Trigger performance  (pginfo <pginfo@t1.unisoftbg.com>)
Ответы Re: Trigger performance
Re: Trigger performance
Список pgsql-performance
Hi,

thanks for the answer.
It is very interest, because I readet many times that if I write the trigger
in "C" it will work faster.
In wich case will this trigger work faster if write it in "C"?
In all my triggres I have "select ...." or "insert into mytable select ..."
or "update mytable set ...where...".
I need this info because I have a table with ~1.5 M rows and if I start to
update 300 K from this rows it takes ~ 2h.
If I remove the trigger for this table all the time is ~ 1 min.

regards,
ivan.

Tom Lane wrote:

> pginfo <pginfo@t1.unisoftbg.com> writes:
> > I was supprised that the pgsql trigger take ~8 sec. to insert this rows
> > and the "C" trigger take ~ 17 sec.
>
> The reason is that plpgsql caches the plan for the invoked SELECT,
> whereas the way you coded the C function, it's re-planning that SELECT
> on every call.
>
>                         regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




В списке pgsql-performance по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Trigger performance
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Trigger performance