提交 a54d84a3 编写于 作者: H Heikki Linnakangas

Avoid assigning an XID to DTX_CONTEXT_QE_AUTO_COMMIT_IMPLICIT queries.

This avoids a lot of overhead for short read-only queries. We still don't
do lazy assignment for most transactions, like PostgreSQL 8.3 does, but
this is a step in the right direction.
上级 fabb8d58
......@@ -2984,6 +2984,7 @@ StartTransaction(void)
QEDtxContextInfo.distributedTimeStamp,
QEDtxContextInfo.distributedXid,
&s->transactionId);
XactLockTableInsert(s->transactionId);
s->distribXid = QEDtxContextInfo.distributedXid;
......@@ -2996,15 +2997,13 @@ StartTransaction(void)
/*
* We don't use the distributed xid map since this may be one of funny
* distributed queries the executor uses behind the scenes for estimation
* work. This transaction will auto-commit, and then we will follow it with the
* real user command.
*
* Generate a new transaction id.
* work. We also don't need a local XID right now - we let it be assigned
* lazily, as on a local transaction. This transaction will auto-commit, and
* then we will follow it with the real user command.
*/
Assert(DistributedTransactionContext == DTX_CONTEXT_QE_AUTO_COMMIT_IMPLICIT);
s->transactionId = GetNewTransactionId(false, true);
}
/*
* now() and statement_timestamp() should be the same time
*/
......@@ -3034,7 +3033,7 @@ StartTransaction(void)
*
* Generate a new transaction id
*/
s->transactionId = GetNewTransactionId(false, true);
AssignTransactionId(s);
elog((Debug_print_full_dtm ? LOG : DEBUG5),
"Not tied to distributed transaction id, but still coordinated "
......@@ -3042,11 +3041,6 @@ StartTransaction(void)
s->transactionId);
}
/*
* Common.
*/
XactLockTableInsert(s->transactionId);
PG_TRACE1(transaction__start, s->transactionId);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册