From PostgreSQL 9.6 Release Notes :
You can strictly parallelize only read-only queries that access the driving table through sequential scanning.
My question is: if the CTE (proposal WITH) contains a read-only operation, but the results are used to supply a write operation, for example, inserts or updates are also prohibited to parallelize sequential test?
I mean, since CTE is very similar to a temporary table that exists only to execute the current query, can I assume that its internal query can take advantage of the new parallel seq-scan PostgreSQL 9.6? Or, otherwise, is it processed as a subquery and cannot perform parallel scanning?
For example, consider this query:
WITH foobarbaz AS (
SELECT foo FROM bar
WHERE some_expensive_function(baz)
)
DELETE FROM bar
USING foobarbaz
WHERE bar.foo = foobarbaz.foo
;
Is foobarbaz calculation supposed to be parallel or forbidden due to a suggestion for deletion?
If this is not allowed, I thought that you could replace the CTE with the CREATE TEMPORARY TABLE statement. But I think that I will get into the same problem as CREATE TABLE - write operation. I am wrong?
, , , - / . . : / begin commit, ? , , Postgres.
, , SQL-, . , , , .
, 8 , .
, , : , . , .
, .
EDIT:
, :
@a_horse_with_no_name (), CTE DML , CTE, CTE ( ).
wiki , , .
, , , . ( ).
- , @a_horse_with_no_name : DbLink . , , , postgres_fdw, , , .
, , , ( , ).
... , , ( ) script , , .
-, , , .