Commit c9d7dbac authored by Heikki Linnakangas's avatar Heikki Linnakangas

Skip truncating ON COMMIT DELETE ROWS temp tables, if the transaction hasn't

touched any temporary tables.

We could try harder, and keep track of whether we've inserted to any temp
tables, rather than accessed them, and which temp tables have been inserted
to. But this is dead simple, and already covers many interesting scenarios.
parent fd4ced52
...@@ -10124,6 +10124,12 @@ PreCommit_on_commit_actions(void) ...@@ -10124,6 +10124,12 @@ PreCommit_on_commit_actions(void)
/* Do nothing (there shouldn't be such entries, actually) */ /* Do nothing (there shouldn't be such entries, actually) */
break; break;
case ONCOMMIT_DELETE_ROWS: case ONCOMMIT_DELETE_ROWS:
/*
* If this transaction hasn't accessed any temporary
* relations, we can skip truncating ON COMMIT DELETE ROWS
* tables, as they must still be empty.
*/
if (MyXactAccessedTempRel)
oids_to_truncate = lappend_oid(oids_to_truncate, oc->relid); oids_to_truncate = lappend_oid(oids_to_truncate, oc->relid);
break; break;
case ONCOMMIT_DROP: case ONCOMMIT_DROP:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment