[SERVER-1673] Allow distinct to use indexes Created: 24/Aug/10  Updated: 17/May/17  Resolved: 14/Nov/10

Status: Closed
Project: Core Server
Component/s: Index Maintenance, Querying
Affects Version/s: 1.6.1
Fix Version/s: 1.7.3

Type: Improvement Priority: Major - P3
Reporter: Kevin McCarthy Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 9
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-2094 distinct cheat with indexes Closed
is depended on by SERVER-29244 CLONE - distinct cheat with indexes Closed
Related
Participants:

 Description   

db.ensureIndex(

{x:1}

)

db.distinct('x')

Distinct apparently does a full table scan, even though it could use the index to speed things up a bit. Please see the discussion here:

http://groups.google.com/group/mongodb-user/browse_thread/thread/912fd4b9e303fb04/

My current application of MongoDB relies on fast distincts, and I think this would help quite a bit.



 Comments   
Comment by auto [ 14/Nov/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: disinct can pull data from indexes and will choose an index to use if sensible SERVER-1673
/mongodb/mongo/commit/2ce44e8c85960ec6fb6635840e46048adf7bf319

Comment by auto [ 14/Nov/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: if key is in index, use it for distinct SERVER-1673
/mongodb/mongo/commit/2c9fe6b42795a126a5bc24d9810e4e25b8e98a82

Comment by auto [ 14/Nov/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: prep work for distinct w/indexes SERVER-1673
/mongodb/mongo/commit/8450572c054a19aace4b962b97fafc0c58eacfe2

Generated at Thu Feb 08 02:57:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.