Re: Why the sql is not executed in parallel mode

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: Why the sql is not executed in parallel mode
Дата
Msg-id CAEepm=03s4Yih+c0pCTfKi0O8zgq-P4VfCVEk5VVXcR6aXHm4A@mail.gmail.com
обсуждение исходный текст
Ответ на Why the sql is not executed in parallel mode  (jimmy <mpokky@126.com>)
Список pgsql-general
On Wed, Sep 19, 2018 at 1:53 PM jimmy <mpokky@126.com> wrote:
>
> Why the sql is not executed in parallel mode, does the sql has some problem?
> with sql1 as

Hello Jimmy,

WITH is the problem.  From the manual[1]:  "The following operations
are always parallel restricted.  Scans of common table expressions
(CTEs). ...".  That means that these CTEs can only be scanned in the
leader process.

If you rewrite the query using sub selects it might do better.  FWIW
there is a project to make WITH work like subselects automatically in
a future release of PostgreSQL:

https://www.postgresql.org/message-id/flat/87sh48ffhb.fsf@news-spur.riddles.org.uk

[1] https://www.postgresql.org/docs/10/static/parallel-safety.html

-- 
Thomas Munro
http://www.enterprisedb.com


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

Предыдущее
От: jimmy
Дата:
Сообщение: Why the sql is not executed in parallel mode
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: how to know whether query data from memory after pg_prewarm