Return early for common commands in the utility hook (#3031)

We started copying parse trees by default further on in `multi_ProcessUtility`. That's not a problem for maintenance command, but might register for things like `PREPARE` and `EXECUTE`, which might happen thousands of times per second. Add a few common commands to the check at the start.
pull/3015/head
Marco Slot 2019-09-26 11:43:35 +02:00 committed by Nils Dijk
parent 3e465a6449
commit 32a11bdf6c
1 changed files with 12 additions and 1 deletions

View File

@ -53,6 +53,7 @@
#include "distributed/version_compat.h"
#include "distributed/worker_transaction.h"
#include "lib/stringinfo.h"
#include "nodes/parsenodes.h"
#include "nodes/pg_list.h"
#include "tcop/utility.h"
#include "utils/builtins.h"
@ -116,9 +117,19 @@ multi_ProcessUtility(PlannedStmt *pstmt,
List *ddlJobs = NIL;
bool checkExtensionVersion = false;
if (IsA(parsetree, TransactionStmt))
if (IsA(parsetree, TransactionStmt) ||
IsA(parsetree, LockStmt) ||
IsA(parsetree, ListenStmt) ||
IsA(parsetree, NotifyStmt) ||
IsA(parsetree, ExecuteStmt) ||
IsA(parsetree, PrepareStmt) ||
IsA(parsetree, DiscardStmt) ||
IsA(parsetree, DeallocateStmt))
{
/*
* Skip additional checks for common commands that do not have any
* Citus-specific logic.
*
* Transaction statements (e.g. ABORT, COMMIT) can be run in aborted
* transactions in which case a lot of checks cannot be done safely in
* that state. Since we never need to intercept transaction statements,