Details
-
Improvement
-
Resolution: Won't Fix
-
Major
-
6.0.0
-
None
Description
Taking the example from the docs at https://docs.couchbase.com/server/6.0/n1ql/n1ql-language-reference/adaptive-indexing.html, we can create an adaptive index like the following:
CREATE INDEX `ai_airport_day_faa`
|
ON `travel-sample`(DISTINCT PAIRS({airportname, city, faa}));
|
This can serve queries like the following, with a fetch phase:
SELECT meta().id FROM `travel-sample` WHERE city="foo" and airportname="bar";
|
However, the following query cannot use the adaptive index, despite the index containing all of the necessary information to provide the correct results:
SELECT meta().id FROM `travel-sample` WHERE city="foo" and airportname="bar" and other_field="baz";
|
It would be good if the query engine realized that it could use the adaptive index to serve the query which has a field not in the index (which will be part of the fetched document).