[ 
https://issues.apache.org/jira/browse/OAK-937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14315726#comment-14315726
 ] 

Thomas Mueller commented on OAK-937:
------------------------------------

I prefer extending the query language, instead of using a new API. For XPath 
and SQL, the "hint" could be an extension of the syntax. I would prefer that 
over a comment, as it allows for stricter parsing. Example:

{noformat}
//*[@jcrModified] = 1] index jcrModified 

select * 
from [nt:base] index [jcrModified] 
where [jcrModified] = 1
{noformat}

See also:
Oracle: http://docs.oracle.com/cd/B19306_01/server.102/b14211/hintsref.htm#i4852
SQLite: https://www.sqlite.org/lang_indexedby.html

If the index is not available, the default should be that the query fail with 
an exception that says the index is missing. We can also support "optional" 
indexes (use the given index if it is available), but I would use a different 
(longer) syntax for that:

{noformat}
//*[@jcrModified] = 1] index jcrModified optional
{noformat}

> Query engine index selection tweaks: shortcut and hint
> ------------------------------------------------------
>
>                 Key: OAK-937
>                 URL: https://issues.apache.org/jira/browse/OAK-937
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core, query
>            Reporter: Alex Parvulescu
>            Priority: Minor
>             Fix For: 1.2
>
>
> This issue covers 2 different changes related to the way the QueryEngine 
> selects a query index:
>  Firstly there could be a way to end the index selection process early via a 
> known constant value: if an index returns a known value token (like -1000) 
> then the query engine would effectively stop iterating through the existing 
> index impls and use that index directly.
>  Secondly it would be nice to be able to specify a desired index (if one is 
> known to perform better) thus skipping the existing selection mechanism (cost 
> calculation and comparison). This could be done via certain query hints [0].
> [0] http://en.wikipedia.org/wiki/Hint_(SQL)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to