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

Alexander Klimetschek commented on OAK-4888:
--------------------------------------------

Awesome!

Some notes/questions:
* Will this catch queries with a suboptimal index that still needs a traversal 
of the index (or more costly things besides an efficient index lookup), say 
ordering by an unindexed property? That was the reason for my original 
cost-based idea; it seems there is a {{bestCost}} readily available in 
{{QueryImpl.getBestSelectorExecutionPlan}} that could be used in addition to 
checking for no index at all ({{bestIndex == null}})
* I think if it logs "too many" warnings this is clearly a problem of the 
application (for the current no-index check) – either ensure there is an index 
or set the {{option(traversal ok)}} on these queries. I don't know why a 
missing index can ever be considered ok :)
* +1 for an osgi configuration; if people enable that, they want to make it the 
default in their application configuration, so their development team catches 
issues early, which is much easier via an osgi configuration than making sure 
the system property is set when starting the oak-based system.


> Warn or fail queries above a configurable cost value
> ----------------------------------------------------
>
>                 Key: OAK-4888
>                 URL: https://issues.apache.org/jira/browse/OAK-4888
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: query
>            Reporter: Alexander Klimetschek
>            Assignee: Thomas Mueller
>              Labels: docs-impacting
>             Fix For: 1.5.13
>
>
> *Problem:* It's easy to run into performance problems with queries that are 
> not backed by an index or miss the right one. Developers writing these 
> queries typically do not have the real large production data, and thus don't 
> see that a query would scale badly, and would not see any traversal warnings, 
> as these only happen with a large number of results.
> *Proposal:* Oak's query engine already calculates a cost estimate to make a 
> decision which index to use, or even if there is any at all. This cost 
> estimate could be used to find out if a query is not supported by an index or 
> with one that is not suitable enough (e.g. ordering by property that is not 
> indexed)
> If a query is above a certain cost value, a big warning could be put out or 
> even the query could be made to fail (maybe a per query option, that you 
> might want to have to "fail" by default to ensure people are not overlooking 
> the problem). The cost limit should be configurable, as it might depend on 
> the hardware power.



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

Reply via email to