Tomas Vondra <tomas.von...@enterprisedb.com> writes: > Note: To be precise this is not about "executions" but about snapshots, > and we could probably simplify the function call with isolation levels > that maintain a single snapshot (e.g. REPEATABLE READ). But we don't.
We don't do that because, in fact, execution is *never* done with the same snapshot used for planning. See comment in postgres.c: * While it looks promising to reuse the same snapshot for query * execution (at least for simple protocol), unfortunately it causes * execution to use a snapshot that has been acquired before locking * any of the tables mentioned in the query. This creates user- * visible anomalies, so refrain. Refer to * https://postgr.es/m/flat/5075d8df.6050...@fuzzy.cz for details. I'm not entirely sure that that locking argument still holds, but having been burned once I'm pretty hesitant to try that again. regards, tom lane