skipped_path = total - insert_path - update_path - delete_path;
Assert(skipped_path >= 0);
- 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 (es->format == EXPLAIN_FORMAT_TEXT && total > 0)
+ {
+ ExplainIndentText(es);
+ appendStringInfoString(es->str, "Tuples:");
+ if (insert_path > 0)
+ appendStringInfo(es->str, " inserted=%.0f", insert_path);
+ if (update_path > 0)
+ appendStringInfo(es->str, " updated=%.0f", update_path);
+ if (delete_path > 0)
+ appendStringInfo(es->str, " deleted=%.0f", delete_path);
+ if (skipped_path > 0)
+ appendStringInfo(es->str, " skipped=%.0f", skipped_path);
+ appendStringInfoChar(es->str, '\n');
+ }
+ else
+ {
+ 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);
+ }
}
}
explain_merge
----------------------------------------------------------------------
Merge on ex_mtarget t (actual rows=0 loops=1)
- Tuples Inserted: 0
- Tuples Updated: 50
- Tuples Deleted: 0
- Tuples Skipped: 0
+ Tuples: updated=50
-> Merge Join (actual rows=50 loops=1)
Merge Cond: (t.a = s.a)
-> Sort (actual rows=50 loops=1)
Sort Key: s.a
Sort Method: quicksort Memory: xxx
-> Seq Scan on ex_msource s (actual rows=100 loops=1)
-(15 rows)
+(12 rows)
-- only updates to selected tuples
SELECT explain_merge('
explain_merge
----------------------------------------------------------------------
Merge on ex_mtarget t (actual rows=0 loops=1)
- Tuples Inserted: 0
- Tuples Updated: 5
- Tuples Deleted: 0
- Tuples Skipped: 45
+ Tuples: updated=5 skipped=45
-> Merge Join (actual rows=50 loops=1)
Merge Cond: (t.a = s.a)
-> Sort (actual rows=50 loops=1)
Sort Key: s.a
Sort Method: quicksort Memory: xxx
-> Seq Scan on ex_msource s (actual rows=100 loops=1)
-(15 rows)
+(12 rows)
-- updates + deletes
SELECT explain_merge('
explain_merge
----------------------------------------------------------------------
Merge on ex_mtarget t (actual rows=0 loops=1)
- Tuples Inserted: 0
- Tuples Updated: 5
- Tuples Deleted: 5
- Tuples Skipped: 40
+ Tuples: updated=5 deleted=5 skipped=40
-> Merge Join (actual rows=50 loops=1)
Merge Cond: (t.a = s.a)
-> Sort (actual rows=50 loops=1)
Sort Key: s.a
Sort Method: quicksort Memory: xxx
-> Seq Scan on ex_msource s (actual rows=100 loops=1)
-(15 rows)
+(12 rows)
-- only inserts
SELECT explain_merge('
explain_merge
----------------------------------------------------------------------
Merge on ex_mtarget t (actual rows=0 loops=1)
- Tuples Inserted: 4
- Tuples Updated: 0
- Tuples Deleted: 0
- Tuples Skipped: 96
+ Tuples: inserted=4 skipped=96
-> Merge Left Join (actual rows=100 loops=1)
Merge Cond: (s.a = t.a)
-> Sort (actual rows=100 loops=1)
Sort Key: t.a
Sort Method: quicksort Memory: xxx
-> Seq Scan on ex_mtarget t (actual rows=45 loops=1)
-(15 rows)
+(12 rows)
-- all three
SELECT explain_merge('
explain_merge
----------------------------------------------------------------------
Merge on ex_mtarget t (actual rows=0 loops=1)
- Tuples Inserted: 10
- Tuples Updated: 9
- Tuples Deleted: 5
- Tuples Skipped: 76
+ Tuples: inserted=10 updated=9 deleted=5 skipped=76
-> Merge Left Join (actual rows=100 loops=1)
Merge Cond: (s.a = t.a)
-> Sort (actual rows=100 loops=1)
Sort Key: t.a
Sort Method: quicksort Memory: xxx
-> Seq Scan on ex_mtarget t (actual rows=49 loops=1)
-(15 rows)
+(12 rows)
DROP TABLE ex_msource, ex_mtarget;
DROP FUNCTION explain_merge(text);