tonysun83 commented on a change in pull request #1069: Mango: change catch-all 
field range priority
URL: https://github.com/apache/couchdb/pull/1069#discussion_r157562091
 
 

 ##########
 File path: src/mango/src/mango_cursor_special.erl
 ##########
 @@ -31,10 +31,12 @@
 create(Db, Indexes, Selector, Opts) ->
     InitialRange = mango_idx_view:field_ranges(Selector),
     CatchAll = [{<<"_id">>, {'$gt', null, '$lt', mango_json_max}}],
-    FieldRanges = lists:append(CatchAll, InitialRange),
+    % order matters here - we only want to use the catchall index
+    % if no other range can fulfill the query (because we know)
+    % catchall is the most expensive range
+    FieldRanges = InitialRange ++ CatchAll,
     Composited = mango_cursor_view:composite_indexes(Indexes, FieldRanges),
     {Index, IndexRanges} = mango_cursor_view:choose_best_index(Db, Composited),
-
 
 Review comment:
   whitespace change

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to