Re: Numeric multiplication overflow errors

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Re: Numeric multiplication overflow errors
Дата
Msg-id CAEudQApjmczxkuz5_kYKEqPOjsqsGuoDc4h3XoPVh0SpW70S_A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Numeric multiplication overflow errors  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: Numeric multiplication overflow errors
Список pgsql-hackers
Em seg., 5 de jul. de 2021 às 06:44, Dean Rasheed <dean.a.rasheed@gmail.com> escreveu:
On Fri, 2 Jul 2021 at 19:48, Ranier Vilela <ranier.vf@gmail.com> wrote:
>
> If you allow me a small suggestion.
> Move the initializations of the variable tmp_var to after check if the function can run.
> Saves some cycles, when not running.
>

OK, thanks. I agree, on grounds of neatness and consistency with
nearby code, so I've done it that way.
Thanks.


Note, however, that it won't make any difference to performance in the
way that you're suggesting -- elog() in Postgres is used for "should
never happen, unless there's a software bug" errors, rather than, say,
"might happen for certain invalid inputs" errors, so init_var() should
always be called in these functions.
I agree that in this case, most of the time, elog is not called.
But by writing this way, you are following the principle of not doing unnecessary work until it is absolutely necessary.
If you follow this principle, in general, the performance will always be better.

regards,
Ranier Vilela

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

Предыдущее
От: Gilles Darold
Дата:
Сообщение: Re: [PATCH] Hooks at XactCommand level
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: "debug_invalidate_system_caches_always" is too long