Re: Trying to the behavior of a parallel query with with a changein the transaction isolation mode - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Trying to the behavior of a parallel query with with a changein the transaction isolation mode
Date
Msg-id 20180212151952.txagreqdwugahsqi@alvherre.pgsql
Whole thread Raw
In response to Trying to the behavior of a parallel query with with a change in thetransaction isolation mode  (Luis Carril <luis.carril@swarm64.com>)
Responses Re: Trying to the behavior of a parallel query with with a change inthe transaction isolation mode
List pgsql-general
Luis Carril wrote:

> The transaction isolation level is serializable. This situation does not normally arise, because parallel query plans
arenot generated when the transaction isolation level is serializable. However, it can happen if the transaction
isolationlevel is changed to serializable after the plan is generated and before it is executed.
 

> BEGIN;
> SET TRANSACTION ISOLATION LEVEL READ COMMITTED, READ ONLY;
> EXPLAIN (COSTS OFF) SELECT avg(a) FROM parallel_big;
> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ ONLY;
> EXPLAIN ANALYZE SELECT avg(a) FROM parallel_big;
> COMMIT;
> 
> 
>      But complains that after the first SELECT (even if it is in an EXPLAIN) the isolation level cannot be changed,
sothe transaction is aborted  and the SELECT is never executed (even sequentially).
 
> 
> 
>      Is there any way to test the possible behavior described in the documentation?

I think you would do a PREPARE in a regular transaction, then open a
transaction changing the isolation level to serializable and try the
EXPLAIN EXECUTE there.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-general by date:

Previous
From: Luis Carril
Date:
Subject: Trying to the behavior of a parallel query with with a change in thetransaction isolation mode
Next
From: GALLIANO Nicolas
Date:
Subject: Barman 2.3 errors