diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2018-04-02 21:12:47 +0100 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2018-04-02 21:12:47 +0100 |
commit | 354f13855e6381d288dfaa52bcd4f2cb0fd4a5eb (patch) | |
tree | 92710660450acee59be62dea485cc26ab147f332 /src/backend/commands/explain.c | |
parent | e6597dc3533946b98acba7871bd4ca1f7a3d4c1d (diff) | |
download | postgresql-354f13855e6381d288dfaa52bcd4f2cb0fd4a5eb.tar.gz postgresql-354f13855e6381d288dfaa52bcd4f2cb0fd4a5eb.zip |
Modified files for MERGE
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r-- | src/backend/commands/explain.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 8a58672a94e..79f639d5e27 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -946,6 +946,9 @@ ExplainNode(PlanState *planstate, List *ancestors, case CMD_DELETE: pname = operation = "Delete"; break; + case CMD_MERGE: + pname = operation = "Merge"; + break; default: pname = "???"; break; @@ -3007,6 +3010,10 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors, operation = "Delete"; foperation = "Foreign Delete"; break; + case CMD_MERGE: + operation = "Merge"; + foperation = "Foreign Merge"; + break; default: operation = "???"; foperation = "Foreign ???"; @@ -3129,6 +3136,32 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors, other_path, 0, es); } } + else if (node->operation == CMD_MERGE) + { + /* EXPLAIN ANALYZE display of actual outcome for each tuple proposed */ + if (es->analyze && mtstate->ps.instrument) + { + double total; + double insert_path; + double update_path; + double delete_path; + double skipped_path; + + InstrEndLoop(mtstate->mt_plans[0]->instrument); + + /* count the number of source rows */ + total = mtstate->mt_plans[0]->instrument->ntuples; + insert_path = mtstate->ps.instrument->nfiltered1; + update_path = mtstate->ps.instrument->nfiltered2; + delete_path = mtstate->ps.instrument->nfiltered3; + skipped_path = total - insert_path - update_path - delete_path; + + ExplainPropertyFloat("Tuples Inserted", NULL, insert_path, 0, es); + ExplainPropertyFloat("Tuples Updated", NULL, update_path, 0, es); + ExplainPropertyFloat("Tuples Deleted", NULL, delete_path, 0, es); + ExplainPropertyFloat("Tuples Skipped", NULL, skipped_path, 0, es); + } + } if (labeltargets) ExplainCloseGroup("Target Tables", "Target Tables", false, es); |