From: | guyren(at)relevantlogic(dot)com |
---|---|
To: | PG-General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | Advice on setting cost for function |
Date: | 2019-06-05 15:08:04 |
Message-ID: | 27621de6-c05b-493c-bf53-49539cb04577@Spark |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
The documentation in CREATE FUNCTION is fine as far is it goes regarding the COST setting, but that isn’t very far, and I haven’t had any luck finding good advice.
How do I determine what value to set as the COST of a function? I understand that it’s a relative, abstract, per-row sort of thing, but that’s not quite enough to go on to do it well.
If I have a function that looks up a single value from an index, should that be lower than 100? 20, say?
If I have a function that calls multiple other functions, each of which does a reasonable amount of work, should I set the caller to a higher COST, or will Postgres use the costs of the functions it calls?
I can imagine that a SQL function which is just inlined might ignore the COST estimate. Is that so? Are there other such considerations?
In general, a section in the CREATE FUNCTION documentation of two or three paragraphs with a few examples and general guidelines would be very helpful. I would be happy to write it if someone will explain it to me.
From | Date | Subject | |
---|---|---|---|
Next Message | Ron | 2019-06-05 15:09:08 | Re: configure multiple repository path in pgbackrest |
Previous Message | Laurenz Albe | 2019-06-05 15:00:37 | Re: granting right to create and delete just one database |