Operational Defect Database

BugZero found this defect 70 days ago.

MongoDB | 2604100

Make distinct command on views use DISTINCT_SCAN

Last update date:

3/14/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

While distinct command may generate DISTINCT_SCAN plans, it doesn't do so in the case of views (including identity views).

Top User Comments


Steps to Reproduce

const coll = assertDropAndRecreateCollection(db, "coll"); const viewName = "identityView"; assert.commandWorked(db.createView(viewName, coll.getName(), [])); assert.commandWorked(coll.createIndexes([{a: 1}])); // Performs DISTINCT_SCAN over 'a'. jsTestLog(coll.explain().distinct('a')); // Performs coll scan, while the rest of the work is done in agg. jsTestLog(db[viewName].explain().distinct('a')); // Performs index scan on 'a', while the rest of the work is done in agg. jsTestLog(db[viewName].explain().distinct('a', {}, {hint: 'a_1'}));

Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Backlog

Learn More

Search:

...