mirror of https://gitee.com/bigwinds/arangodb
Reinclude performance optimization of Return in Subquery (#8844)
* Removed template parameter from ReturnExecutor and enforce it to be passthrough * Revert "Removed template parameter from ReturnExecutor and enforce it to be passthrough" This was unfortunately going into the wrong direction. This reverts commit 6a488ee1d97f519c7382ebf783e4217cdb403458. * Create a new block with exactly 1 Register for a ReturnBlock that is supposed to be used as Subquery result * Fixed register assertoin for return block optimization * nished comment where i stop in the midlle of a sent
This commit is contained in:
parent
e6b73726fd
commit
efe451e8fc
|
@ -617,9 +617,7 @@ ExecutionNode const* ExecutionNode::getLoop() const {
|
||||||
auto type = node->getType();
|
auto type = node->getType();
|
||||||
|
|
||||||
if (type == ENUMERATE_COLLECTION || type == INDEX || type == TRAVERSAL ||
|
if (type == ENUMERATE_COLLECTION || type == INDEX || type == TRAVERSAL ||
|
||||||
type == ENUMERATE_LIST || type == SHORTEST_PATH
|
type == ENUMERATE_LIST || type == SHORTEST_PATH || type == ENUMERATE_IRESEARCH_VIEW) {
|
||||||
|| type == ENUMERATE_IRESEARCH_VIEW
|
|
||||||
) {
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1762,8 +1760,7 @@ bool SubqueryNode::mayAccessCollections() {
|
||||||
|
|
||||||
// if the subquery contains any of these nodes, it may access data from
|
// if the subquery contains any of these nodes, it may access data from
|
||||||
// a collection
|
// a collection
|
||||||
std::vector<ExecutionNode::NodeType> const types = {
|
std::vector<ExecutionNode::NodeType> const types = {ExecutionNode::ENUMERATE_IRESEARCH_VIEW,
|
||||||
ExecutionNode::ENUMERATE_IRESEARCH_VIEW,
|
|
||||||
ExecutionNode::ENUMERATE_COLLECTION,
|
ExecutionNode::ENUMERATE_COLLECTION,
|
||||||
ExecutionNode::INDEX,
|
ExecutionNode::INDEX,
|
||||||
ExecutionNode::INSERT,
|
ExecutionNode::INSERT,
|
||||||
|
@ -2037,10 +2034,17 @@ std::unique_ptr<ExecutionBlock> ReturnNode::createBlock(
|
||||||
|
|
||||||
bool const returnInheritedResults = isRoot && !isDBServer;
|
bool const returnInheritedResults = isRoot && !isDBServer;
|
||||||
|
|
||||||
|
// This is an important performance improvement:
|
||||||
|
// If we have inherited results, we do move the block through
|
||||||
|
// and do not modify it in any way.
|
||||||
|
// In the other case it is important to shrink the matrix to exactly
|
||||||
|
// one register that is stored within the DOCVEC.
|
||||||
|
RegisterId const numberOutputRegisters =
|
||||||
|
returnInheritedResults ? getRegisterPlan()->nrRegs[getDepth()] : 1;
|
||||||
|
|
||||||
ReturnExecutorInfos infos(inputRegister,
|
ReturnExecutorInfos infos(inputRegister,
|
||||||
getRegisterPlan()->nrRegs[previousNode->getDepth()],
|
getRegisterPlan()->nrRegs[previousNode->getDepth()],
|
||||||
getRegisterPlan()->nrRegs[getDepth()], _count,
|
numberOutputRegisters, _count, returnInheritedResults);
|
||||||
returnInheritedResults);
|
|
||||||
if (returnInheritedResults) {
|
if (returnInheritedResults) {
|
||||||
return std::make_unique<ExecutionBlockImpl<ReturnExecutor<true>>>(&engine, this,
|
return std::make_unique<ExecutionBlockImpl<ReturnExecutor<true>>>(&engine, this,
|
||||||
std::move(infos));
|
std::move(infos));
|
||||||
|
|
|
@ -50,7 +50,11 @@ ExecutorInfos::ExecutorInfos(
|
||||||
if (_outRegs == nullptr) {
|
if (_outRegs == nullptr) {
|
||||||
_outRegs = std::make_shared<decltype(_outRegs)::element_type>();
|
_outRegs = std::make_shared<decltype(_outRegs)::element_type>();
|
||||||
}
|
}
|
||||||
TRI_ASSERT(nrInputRegisters <= nrOutputRegisters);
|
// The second assert part is from ReturnExecutor special case, we shrink all
|
||||||
|
// results into a single Register column.
|
||||||
|
TRI_ASSERT((nrInputRegisters <= nrOutputRegisters) ||
|
||||||
|
(nrOutputRegisters == 1 && _registersToKeep->empty() &&
|
||||||
|
_registersToClear->empty()));
|
||||||
|
|
||||||
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
|
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
|
||||||
for (RegisterId const inReg : *_inRegs) {
|
for (RegisterId const inReg : *_inRegs) {
|
||||||
|
|
Loading…
Reference in New Issue