Re: PostgreSQL executing my function too many times during query

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PostgreSQL executing my function too many times during query
Дата
Msg-id 18643.1210892723@sss.pgh.pa.us
обсуждение исходный текст
Ответ на PostgreSQL executing my function too many times during query  ("D. Dante Lorenso" <dante@lorenso.com>)
Ответы Re: PostgreSQL executing my function too many times during query  ("D. Dante Lorenso" <dante@lorenso.com>)
Список pgsql-general
"D. Dante Lorenso" <dante@lorenso.com> writes:
> This format causes the function to execute too many times:

>    SELECT COUNT(*) AS result
>    FROM credit_card
>    WHERE card_number_enc = cc_encrypt('4111-1111-1111-1111', 'pwd')
>    AND card_number_enc != cc_encrypt('4111111111111111', 'pwd');

If the function is marked immutable that query should certainly evaluate
it only twice.

I notice that the EXPLAINs show it as credit_card_encrypt() not
cc_encrypt() --- maybe you got confused about which function you
were adjusting the properties of?

            regards, tom lane

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

Предыдущее
От: "D. Dante Lorenso"
Дата:
Сообщение: PostgreSQL executing my function too many times during query
Следующее
От: "Vance Maverick"
Дата:
Сообщение: triggers: dynamic references to fields in NEW and OLD?