Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc9d7dba

Browse files
committed
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 temptables, rather than accessed them, and which temp tables have been insertedto. But this is dead simple, and already covers many interesting scenarios.
1 parentfd4ced5 commitc9d7dba

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10124,7 +10124,13 @@ PreCommit_on_commit_actions(void)
1012410124
/* Do nothing (there shouldn't be such entries, actually) */
1012510125
break;
1012610126
caseONCOMMIT_DELETE_ROWS:
10127-
oids_to_truncate=lappend_oid(oids_to_truncate,oc->relid);
10127+
/*
10128+
* If this transaction hasn't accessed any temporary
10129+
* relations, we can skip truncating ON COMMIT DELETE ROWS
10130+
* tables, as they must still be empty.
10131+
*/
10132+
if (MyXactAccessedTempRel)
10133+
oids_to_truncate=lappend_oid(oids_to_truncate,oc->relid);
1012810134
break;
1012910135
caseONCOMMIT_DROP:
1013010136
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp