PostgreSQL 12.4 Parallel Query doesn't work while EXPLAIN is OK

Поиск
Список
Период
Сортировка
От mobigroup
Тема PostgreSQL 12.4 Parallel Query doesn't work while EXPLAIN is OK
Дата
Msg-id 7091E3D2-C056-421B-A95C-F2F83EABF9E7@mobigroup.ru
обсуждение исходный текст
Ответы Re: PostgreSQL 12.4 Parallel Query doesn't work while EXPLAIN is OK  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-general
Hi,

I have strange behaviour when EXPLAIN returns parallel execution plan but the query execution is not parallel. The query looks as

        SELECT
            plpgsql_function(...parameters…)
        FROM table as t
        WHERE id=1
        UNION ALL
        SELECT
            plpgsql_function(...parameters…)
        FROM table as t
        WHERE id=2
        UNION ALL
...

EXPLAIN outputs looks ok:

Append  (cost=0.00..10.25 rows=8 width=32)
  ->  Gather  (cost=0.00..1.27 rows=1 width=32)
        Workers Planned: 8
        ->  Parallel Seq Scan on table t  (cost=0.00..1.27 rows=1 width=32)
              Filter: (id = 1)
  ->  Gather  (cost=0.00..1.27 rows=1 width=32)
        Workers Planned: 8
        ->  Parallel Seq Scan on table t_1  (cost=0.00..1.27 rows=1 width=32)
              Filter: (id = 2)
  ->  Gather  (cost=0.00..1.27 rows=1 width=32)
...


But the query still uses just one core and I see sequential RAISE NOTICE outputs from the function plpgsql_function().

select version();
                                                             version                                                             
---------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 12.4 (Ubuntu 12.4-1.pgdg18.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit


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

Предыдущее
От: David Tinker
Дата:
Сообщение: How much shared memory does Postgresql need per max_locks_per_transaction?
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: PostgreSQL 12.4 Parallel Query doesn't work while EXPLAIN is OK