aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-02-28 23:27:18 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-02-28 23:28:06 -0500
commitc0b00760365c74308e9e0719c993eadfbcd090c2 (patch)
tree28226f24ffb13c5788e1e29606b56bad4d672b72 /src/backend/commands/explain.c
parent57e9bda5ec6a032e1e6d51dad5e534a11669c6bf (diff)
downloadpostgresql-c0b00760365c74308e9e0719c993eadfbcd090c2.tar.gz
postgresql-c0b00760365c74308e9e0719c993eadfbcd090c2.zip
Rearrange snapshot handling to make rule expansion more consistent.
With this patch, portals, SQL functions, and SPI all agree that there should be only a CommandCounterIncrement between the queries that are generated from a single SQL command by rule expansion. Fetching a whole new snapshot now happens only between original queries. This is equivalent to the existing behavior of EXPLAIN ANALYZE, and it was judged to be the best choice since it eliminates one source of concurrency hazards for rules. The patch should also make things marginally faster by reducing the number of snapshot push/pop operations. The patch removes pg_parse_and_rewrite(), which is no longer used anywhere. There was considerable discussion about more aggressive refactoring of the query-processing functions exported by postgres.c, but for the moment nothing more has been done there. I also took the opportunity to refactor snapmgr.c's API slightly: the former PushUpdatedSnapshot() has been split into two functions. Marko Tiikkaja, reviewed by Steve Singer and Tom Lane
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 23819a0fdb7..cc7acb3320e 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -366,7 +366,8 @@ ExplainOnePlan(PlannedStmt *plannedstmt, ExplainState *es,
* Use a snapshot with an updated command ID to ensure this query sees
* results of any previously executed queries.
*/
- PushUpdatedSnapshot(GetActiveSnapshot());
+ PushCopiedSnapshot(GetActiveSnapshot());
+ UpdateActiveSnapshotCommandId();
/* Create a QueryDesc requesting no output */
queryDesc = CreateQueryDesc(plannedstmt, queryString,