Start using order with pattern in optimizer
This commit is contained in:
@@ -201,11 +201,11 @@ namespace mongo {
|
||||
uassert( "bad hint", false );
|
||||
}
|
||||
|
||||
BSONObj bestIndex = indexForPattern( ns, fbs_.pattern() );
|
||||
BSONObj bestIndex = indexForPattern( ns, fbs_.pattern( order_ ) );
|
||||
if ( !bestIndex.isEmpty() ) {
|
||||
usingPrerecordedPlan_ = true;
|
||||
mayRecordPlan_ = false;
|
||||
oldNScanned_ = nScannedForPattern( ns, fbs_.pattern() );
|
||||
oldNScanned_ = nScannedForPattern( ns, fbs_.pattern( order_ ) );
|
||||
if ( !strcmp( bestIndex.firstElement().fieldName(), "$natural" ) ) {
|
||||
// Table scan plan
|
||||
plans_.push_back( PlanPtr( new QueryPlan( fbs_, order_ ) ) );
|
||||
@@ -262,7 +262,7 @@ namespace mongo {
|
||||
// plans_.size() > 1 if addOtherPlans was called in Runner::run().
|
||||
if ( res->complete() || plans_.size() > 1 )
|
||||
return res;
|
||||
registerIndexForPattern( fbs_.ns(), fbs_.pattern(), BSONObj(), 0 );
|
||||
registerIndexForPattern( fbs_.ns(), fbs_.pattern( order_ ), BSONObj(), 0 );
|
||||
init();
|
||||
}
|
||||
Runner r( *this, op );
|
||||
|
||||
Reference in New Issue
Block a user