Advice on setting cost for function

Поиск
Список
Период
Сортировка
От guyren@relevantlogic.com
Тема Advice on setting cost for function
Дата
Msg-id 27621de6-c05b-493c-bf53-49539cb04577@Spark
обсуждение исходный текст
Ответы Re: Advice on setting cost for function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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.

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

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: granting right to create and delete just one database
Следующее
От: Ron
Дата:
Сообщение: Re: configure multiple repository path in pgbackrest