Re: Trigger function cost

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Trigger function cost
Дата
Msg-id 13658.1239287263@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Trigger function cost  (Glyn Astill <glynastill@yahoo.co.uk>)
Ответы Re: Trigger function cost  (Glyn Astill <glynastill@yahoo.co.uk>)
Список pgsql-general
Glyn Astill <glynastill@yahoo.co.uk> writes:
> I see that when I create a volatile plpgsql trigger function it gets given a cost of 100 and a c function gets given
acost of 1. 

> Is there any reason to mess with this?

No.  The planner doesn't actually bother to figure the cost of triggers
anyway, since presumably every correct plan will fire the same set of
triggers.  So even if you had a more accurate cost estimate than that
one, it wouldn't get used for anything.

Now, for ordinary non-trigger functions, it might be worth paying
some attention to the cost estimate.  "1" is intended to denote the
cost of a reasonably simple C function, so PL functions should pretty
much always have costs that are large multiples of that.  100 is a
reasonable default, but if you know better you can put something else.

            regards, tom lane

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

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: Postgres: Starting Server in background mode
Следующее
От: Marcin Krol
Дата:
Сообщение: complicated query (newbie..)