mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Show GIDs of two-phase commit commands as constants in pg_stat_statements
This relies on the "location" field added to TransactionStmt in 31de7e6
,
now applied to the "gid" field used by 2PC commands. These commands are
now reported like:
COMMIT PREPARED $1
PREPARE TRANSACTION $1
ROLLBACK PREPARED $1
Applying constants for these commands is a huge advantage for workloads
that rely a lot on 2PC commands with different GIDs. Some tests are
added to track the new behavior.
Reviewed-by: Julien Rouhaud
Discussion: https://postgr.es/m/ZMhT9kNtJJsHw6jK@paquier.xyz
This commit is contained in:
@@ -10924,7 +10924,7 @@ TransactionStmt:
|
||||
|
||||
n->kind = TRANS_STMT_PREPARE;
|
||||
n->gid = $3;
|
||||
n->location = -1;
|
||||
n->location = @3;
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
| COMMIT PREPARED Sconst
|
||||
@@ -10933,7 +10933,7 @@ TransactionStmt:
|
||||
|
||||
n->kind = TRANS_STMT_COMMIT_PREPARED;
|
||||
n->gid = $3;
|
||||
n->location = -1;
|
||||
n->location = @3;
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
| ROLLBACK PREPARED Sconst
|
||||
@@ -10942,7 +10942,7 @@ TransactionStmt:
|
||||
|
||||
n->kind = TRANS_STMT_ROLLBACK_PREPARED;
|
||||
n->gid = $3;
|
||||
n->location = -1;
|
||||
n->location = @3;
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
;
|
||||
|
Reference in New Issue
Block a user