Are snapshots generated for each sub query inside a Postgres READ_COMMITTED transaction?

Database Administrators Asked on December 15, 2020

From what I understand – in a READ_COMMITTED Postgres transaction “the transaction obtains a snapshot whenever an SQL command is executed” source. Does this mean a snapshot will be obtained for each sub query in a nested query? Does the use of CTEs in place of sub queries affect this behavior?

One Answer

The snapshot 'created' is per statement regardless of whether that statement contains subqueries or not. From the documentation:

... This level is different from Read Committed in that a query in a repeatable read transaction sees a snapshot as of the start of the first non-transaction-control statement in the transaction, not as of the start of the current statement within the transaction.

Answered by nagamocha on December 15, 2020

Add your own answers!

Related Questions

Read after write in Galera

3  Asked on December 4, 2021


Generate SQL Table DDL from a View

2  Asked on December 4, 2021 by user162241


MySQL taking up 400% CPU

2  Asked on December 4, 2021 by littlelebowski


No output when use pymongo watch()

1  Asked on December 2, 2021 by red-black


changing the connection string in SQL Server

1  Asked on November 30, 2021 by teja


SSIS Excel Import – First row getting skipped

1  Asked on November 30, 2021 by mithun-john-jacob


Get if field has max value and display value

2  Asked on November 30, 2021 by carlos-alberto-martinez-martin


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP