[SERVER-109] $or should use indexes Created: 17/Jun/09  Updated: 12/Jul/16  Resolved: 09/Jun/10

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 1.5.3

Type: New Feature Priority: Major - P3
Reporter: Eliot Horowitz (Inactive) Assignee: Aaron Staple
Resolution: Done Votes: 9
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-205 $or Closed
is depended on by SERVER-205 $or Closed
Participants:

 Description   

> db.foo.ensureIndex(

{ a : 1 }

)
true
> db.foo.ensureIndex(

{ b : 1 }

)
true
> db.foo.find(

{ a : 1 }

).explain()
{"cursor" : "BtreeCursor a_1" , "startKey" :

{"a" : 1}

, "endKey" :

{"a" : 1}

, "nscanned" : 2 , "n" : 2 , "millis" : 0 , "allPlans" : [{"cursor" : "BtreeCursor a_1" , "startKey" :

{"a" : 1}

, "endKey" : {"a" : 1}}]}
> db.foo.find( { $or : [

{ a : 1 }

,

{ b : 1 }

} ).explain()
Wed Jun 17 06:57:15 JS Error: SyntaxError: missing ] after element list (anon):2147
> db.foo.find( { $or : [

{ a : 1 }

,

{ b : 1 }

] ).explain()
Wed Jun 17 06:57:20 JS Error: SyntaxError: missing } after property list (anon):2147
> db.foo.find( { $or : [

{ a : 1 }

,

{ b : 1 }

] } ).explain()
{"cursor" : "BasicCursor" , "startKey" : {} , "endKey" : {} , "nscanned" : 3 , "n" : 0 , "millis" : 0 , "allPlans" : [{"cursor" : "BasicCursor" , "startKey" : {} , "endKey" : {}}]}
> for ( i=0; i<2000; i++ ){ db.foo.save(

{ a : i }

); }
> for ( i=0; i<2000; i++ ){ db.foo.save(

{ h : i }

); }
> for ( i=0; i<2000; i++ ){ db.foo.save(

{ b : i }

); }
> db.foo.find( { $or : [

{ a : 1 }

,

{ b : 1 }

] } ).explain()
{"cursor" : "BasicCursor" , "startKey" : {} , "endKey" : {} , "nscanned" : 6003 , "n" : 0 , "millis" : 2 , "allPlans" : [{"cursor" : "BasicCursor" , "startKey" : {} , "endKey" : {}}]}



 Comments   
Comment by auto [ 10/Jun/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 make simplifiedQuery match actual btree cursor bounds when necessary
http://github.com/mongodb/mongo/commit/a8fd0b6ac537541f516c5d80bab6ce7fcc7f0083

Comment by auto [ 09/Jun/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 expand $in clauses in simplifiedQuery
http://github.com/mongodb/mongo/commit/eabc79c785d7687af057b4d0dd3ee657fa32760d

Comment by auto [ 09/Jun/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 range diff after compound index scan
http://github.com/mongodb/mongo/commit/a18d67076188ae7288d993a6581daea444ac1cf3

Comment by auto [ 09/Jun/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 fix range diff (based on selected index)
http://github.com/mongodb/mongo/commit/87f204e44fb688fc1787028b3b409cca9cd178ef

Comment by Aaron Staple [ 09/Jun/10 ]

SERVER-1205, SERVER-1206, and SERVER-1207 describe a few remaining issues, but the main implementation is done.

Comment by auto [ 08/Jun/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 field range operation enhancements / tests
http://github.com/mongodb/mongo/commit/1dd024da17ce2bb42c0e8a4e05c62ec6738b7ebc

Comment by auto [ 08/Jun/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 handle dynamically removed or clauses when iterating clauses
http://github.com/mongodb/mongo/commit/5be4d78fba6c8ed16aa021f294ea20111029c86a

Comment by auto [ 03/Jun/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 cleanup
http://github.com/mongodb/mongo/commit/a87557466874e0e84df5243c7a851492aea5e018

Comment by auto [ 01/Jun/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 reinstate or2 test
http://github.com/mongodb/mongo/commit/e40db913fc43fa3eff61099ed312c1391b4cea9b

Comment by auto [ 27/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 don't create extra builder when don't need it
http://github.com/mongodb/mongo/commit/44a79b42ae557684599d91996a14c3b149ad6dbd

Comment by auto [ 26/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 forgot save
http://github.com/mongodb/mongo/commit/075874207e6b189cd2428de570ee3b9b46471182

Comment by auto [ 26/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 explain
http://github.com/mongodb/mongo/commit/ea362c0ca4c11c67358f4757741cc5f5d8839a52

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 real query skip/limit
http://github.com/mongodb/mongo/commit/2a290e98a640a213774f1353f10dfdf0d59c0cbb

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 remove matcher from ClientCursor
http://github.com/mongodb/mongo/commit/6a0f9dfa91f4ff4e5fe40b097636fc220fdbbe77

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 finish rewriting bestGuess code path
http://github.com/mongodb/mongo/commit/349d039224e9885723f60ec5d46dffdc6689e69f

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 convert remaining dbcommands, fix clone as capped issue w/ getmore
http://github.com/mongodb/mongo/commit/b2a9ff3aeac23468b2008ff8c70cc5771c14d3cb

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 simplify getMore
http://github.com/mongodb/mongo/commit/fa4e812db842a02cd53ddfa815011aacbee65f1c

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 put Matcher in other Cursors, $or with distinct
http://github.com/mongodb/mongo/commit/713e03c506abc803fca347902fa89815d3c6fe8c

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 cleaner
http://github.com/mongodb/mongo/commit/daf718d7e0c39a7bb901bfd1ef2c7b1f29e49355

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 snapshot and multikey test cases
http://github.com/mongodb/mongo/commit/5f480f2af63f3e3f389005a1b01b0726a33a43b6

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 basic getmore
http://github.com/mongodb/mongo/commit/54921ae594ad644081b37163baadcd9ffcfacfb9

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 fix update prescan/details match issue
http://github.com/mongodb/mongo/commit/595e8104a0814b4f3a7e486bcfc1a32b3040a3ff

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 iterator interface for delete and update
http://github.com/mongodb/mongo/commit/b7add1f6221bd2fc3b6ffe5dcabc35a020a63033

Comment by auto [ 25/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 $or getMore checkpoint
http://github.com/mongodb/mongo/commit/68ce7b981ef580285e2757c16020f2b84ad87901

Comment by auto [ 21/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 guard size in Message append
http://github.com/mongodb/mongo/commit/94792549ea1c9b9654ece5ad177ba4c45a476610

Comment by auto [ 21/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 separate n and oldN for bookkeeping
http://github.com/mongodb/mongo/commit/5dbfc209948f5578e78475032626ff45b448a612

Comment by auto [ 21/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 Message only use vector when necessary
http://github.com/mongodb/mongo/commit/df7520399309b4f8c9d90c910ffc9d0a60ac1e10

Comment by auto [ 21/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 enhance test
http://github.com/mongodb/mongo/commit/e22cd871582a97ee82e8ba7ea2a3461c2c48174b

Comment by auto [ 21/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 basic support for sequential plan scanning with a real query
http://github.com/mongodb/mongo/commit/b75acdc7fbaec291a33b7ff9239d608ddacadf08

Comment by auto [ 21/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 count don't look at more clauses once hit limit
http://github.com/mongodb/mongo/commit/3c2dadcec5f606b8f689d90d7a761f37732f0a77

Comment by Aaron Staple [ 21/May/10 ]

There are a number of corner cases to deal with if we allow a client cursor to support multiple indexes serially. (For example, where we might normally drop the client cursor when a document is deleted, we would need to preserve it and then jump to the next serial index when appropriate.)

I just want to confirm that we want to allow $ors with different indexes across getMore requests before implementing.

Comment by auto [ 20/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 test count skip/limit
http://github.com/mongodb/mongo/commit/ecfa20fafef05388f9be97079910480bdc886b4a

Comment by auto [ 20/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 handle no index match case in remove
http://github.com/mongodb/mongo/commit/e4424bbe838935dadad08a4eec8714f91a80e507

Comment by auto [ 20/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 fix justOne regression
http://github.com/mongodb/mongo/commit/1b3225224b1eea5992889220592473eebc6a42cb

Comment by auto [ 19/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 update test
http://github.com/mongodb/mongo/commit/39514a356d8555aae9e9e7aa83ae6de6f0a11721

Comment by auto [ 19/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 put Message in UserQueryOp
http://github.com/mongodb/mongo/commit/4b2e9d9ac16aab622f3e1c59ae448fe6067e44e4

Comment by auto [ 19/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 enhance multi buffer message
http://github.com/mongodb/mongo/commit/dad28843bd154ab902d64e0c86ab87539a584402

Comment by auto [ 19/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 windows multi send fallback
http://github.com/mongodb/mongo/commit/b55098dd80f10622481bd572143acc9815239e34

Comment by auto [ 19/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 reinstate sendmsg
http://github.com/mongodb/mongo/commit/14114b403e1bbf890e0df9c3517a25db12e7a925

Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 fix multi send issue in commented code
http://github.com/mongodb/mongo/commit/4ac5ac7345df64fa701d61ebe10e93be02eeb225

Comment by Aaron Staple [ 13/May/10 ]

TODO notes

  • best guess plan
  • don't rewrite query for each $or clause
  • hint & parsing not parsing $or
  • min/max
  • limit/skip
  • optimize single $or clause?
  • optimize non or index selection
  • sort
  • BSON << element
  • actually limit scanning for later $ors - $nor bounds (need anyway)
  • index chosen based on just a bit of data at end of query/getmore (at least don't record plan as best)
  • direct client & response splitting
  • or2.js
  • scatter gather win
Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 temp compile win
http://github.com/mongodb/mongo/commit/2b4eaa94889a45db199cae250c97ce6ee2b745d6

Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 temp compile win
http://github.com/mongodb/mongo/commit/38dd2871ad977dd01e023634db3c8019bde9ba64

Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 temp compile win
http://github.com/mongodb/mongo/commit/501b8d4d6654e6ee1586d64a245f237c8dc6566a

Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 disable test
http://github.com/mongodb/mongo/commit/d2d668d31408dee1707a814fb932ef59e8dcdb24

Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 $or checkpoint
http://github.com/mongodb/mongo/commit/d72e26995e15c9c632ff9ddd0c6fa5f53e859109

Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 $or checkpoint
http://github.com/mongodb/mongo/commit/0443cbae47175fb20ecf487035a6ecc8eb4f7ab3

Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 multi buffer message
http://github.com/mongodb/mongo/commit/7efe88f445b528969e24c5efa9905244c3a0db6a

Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 let query op short stop multi scan planning, handle or in helpers finone
http://github.com/mongodb/mongo/commit/37f2f983a40a9ba6915648ef1e8b55269c24084e

Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 $or checkpoint
http://github.com/mongodb/mongo/commit/521136dfc06894f4e1e0d7ecd6ef94ec043f3954

Comment by auto [ 13/May/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-109 parse field ranges of or fields-
http://github.com/mongodb/mongo/commit/34a9c96763c710c2442b217161f682fb3d906813

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