IMMUTABLE and PARALLEL SAFE function markings

Поиск
Список
Период
Сортировка
От Gajus Kuizinas
Тема IMMUTABLE and PARALLEL SAFE function markings
Дата
Msg-id CA+6d-n4dOakgLu2gsTfk9uD2CC9ueNCg+z_mnXA2-=Qaod1Wuw@mail.gmail.com
обсуждение исходный текст
Ответы Re: IMMUTABLE and PARALLEL SAFE function markings  (Vik Fearing <vik.fearing@2ndquadrant.com>)
Список pgsql-hackers
I have defined a function "is_not_distinct" for the purpose of creating a custom operator "===".

CREATE FUNCTION is_not_distinct(a anyelement, b anyelement)
returns boolean
language sql as $$
  select a is not distinct from b;
$$
IMMUTABLE;

CREATE OPERATOR === (
  LEFTARG = anyelement,
  RIGHTARG = anyelement,
  PROCEDURE = is_not_distinct,
  NEGATOR = !==
);

I have observed that the resulting queries were executed without using parallelisation.

I have learned by asking on Freenode that the reason my queries are not using parallelisation is because I have not configured PARALLEL SAFE.

I find it counter-intuitive that a function with IMMUTABLE marking would require an explicit PARALLEL SAFE. It would seem logical that in all cases where a function is appropriately market as IMMUTABLE it would also be PARALLEL SAFE.

I was wondering what is the reason IMMUTABLE functions are not by default PARALLEL SAFE and if the default behaviour could be changed to make IMMUTABLE functions PARALLEL SAFE?

Thank you,

Gajus

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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: pgsql: Integrate recovery.conf into postgresql.conf
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: csv format for psql