v.25.6New Feature

Enable sharing the same storage snapshot across

Added a setting enable_shared_storage_snapshot_in_query to enable sharing the same storage snapshot across all subqueries in a single query. This ensures consistent reads from the same table, even when the table is referenced multiple times within a query. #79471 (Amos Bird).
Added a setting enable_shared_storage_snapshot_in_query that allows all subqueries within a single query to share the same storage snapshot, ensuring consistent reads from the same table when referenced multiple times.

Why it matters

This feature solves the problem of inconsistent data reads when the same table is queried multiple times within a single query. By sharing the same storage snapshot across all subqueries, it guarantees data consistency and stability during query execution.

How to use it

Enable the feature by setting enable_shared_storage_snapshot_in_query to 1 in the session or query settings, for example:

SET enable_shared_storage_snapshot_in_query = 1;

This setting will ensure that all subqueries within the query share the same snapshot of the table data.