-
Type:
Improvement
-
Resolution: Gone away
-
Priority:
Blocker - P1
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The single-field case of this was fixed in SERVER-105788 but apparently using samplingCE to estimate compound indexes is still broken (or became broken for another reason in the meantime):
db.foo.drop();
db.foo.insert({a:'a', b:['b','c']});
db.runCommand({analyze: "foo", key: 'a', numberBuckets: 1000});
db.runCommand({analyze: "foo", key: 'b', numberBuckets: 1000});
db.adminCommand({setParameter: 1, planRankerMode: "samplingCE"});
db.foo.createIndex({a:-1});
# This returns 1 , correctly.
db.foo.find({a:'a'}).explain().queryPlanner.winningPlan;
db.foo.dropIndex('a_-1');
db.foo.createIndex({a:1, b:-1});
# This returns zero, incorrectly
db.foo.find({a:'a'}).explain().queryPlanner.winningPlan;
{
isCached: false,
stage: 'FETCH',
costEstimate: 0.0074987,
cardinalityEstimate: 0,
estimatesMetadata: { ceSource: 'Sampling' },
inputStage: {
stage: 'IXSCAN',
costEstimate: 0.000009999999999999999,
cardinalityEstimate: 0, <<<=== wrong
numKeysEstimate: 0, <<<=== wrong
estimatesMetadata: { ceSource: 'Sampling' },
keyPattern: { a: 1, b: -1 },
indexName: 'a_1_b_-1',
isMultiKey: true,
multiKeyPaths: { a: [], b: [ 'b' ] },
isUnique: false,
isSparse: false,
isPartial: false,
indexVersion: 2,
direction: 'forward',
indexBounds: { a: [ '["a", "a"]' ], b: [ '[MaxKey, MinKey]' ] }
}
}
db.foo.dropIndex('a_1_b_-1');
- depends on
-
SERVER-105788 samplingCE: Cardinality estimate for indexes that are read backwards is 0
-
- Closed
-
- is related to
-
SERVER-105788 samplingCE: Cardinality estimate for indexes that are read backwards is 0
-
- Closed
-