Re: Trigger function cost - Mailing list pgsql-general

From Tom Lane
Subject Re: Trigger function cost
Date
Msg-id 13658.1239287263@sss.pgh.pa.us
Whole thread Raw
In response to Trigger function cost  (Glyn Astill <glynastill@yahoo.co.uk>)
Responses Re: Trigger function cost
List 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 by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Postgres: Starting Server in background mode
Next
From: Marcin Krol
Date:
Subject: complicated query (newbie..)