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

Thomas Mueller commented on OAK-4888:
-------------------------------------

> Will this catch queries with a suboptimal index that still needs a traversal 
> of the index

No, not yet. Currently there cost of indexes is not taken into account. It 
could be, that's true, but I "hope" that we only have indexes that are 
selective (for example, don't have a nodetype index for very common nodetypes). 
As for whether or not this is a problem, I think we need more data (examples).

> say ordering by an unindexed property

If the result is small, then ordering shouldn't be a problem. And I think the 
vast majority of queries have a small result set, so that wouldn't be a 
problem. So the question would be, do we expect _every_ query can have a small 
or large result.

> I don't know why a missing index can ever be considered ok 

The question is, do you consider a path restriction to be an index or not. But 
in general, creating an index has an overhead which is larger than running a 
query, so if you run a query only once, then it's better to not create an index.

> osgi configuration

Long term, I would prefer if there is no config option at all (as that's yet 
another knob that increases the surface area, and can be misused...). I was 
hoping that we can make "fail" the default at some point, and then we can even 
remove the (undocumented) system property.

> we may need a way to allow cancel of a query

Yes, we should have a "management level" tool for that. Right now, it's 
possible to cancel all long running queries by setting the "read limit" in the 
query engine settings (JMX bean) by the way.

> 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