You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2013/12/24 18:23:51 UTC
[jira] [Commented] (JENA-383) The query optimizer generates a
suboptimal query plan in case of nested optionals followed by a filter
[ https://issues.apache.org/jira/browse/JENA-383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13856402#comment-13856402 ]
ASF subversion and git services commented on JENA-383:
------------------------------------------------------
Commit 1553306 from [~andy.seaborne] in branch 'jena/trunk'
[ https://svn.apache.org/r1553306 ]
JENA-595 , JENA-432 , JENA-616 , JENA-293 , JENA-383
Put filter equality rewrite after filter placement because
it may then be possible to apply it when it could not when
covering a larger pattern.
Modify some test that were sensitive to this.
> The query optimizer generates a suboptimal query plan in case of nested optionals followed by a filter
> ------------------------------------------------------------------------------------------------------
>
> Key: JENA-383
> URL: https://issues.apache.org/jira/browse/JENA-383
> Project: Apache Jena
> Issue Type: Improvement
> Components: ARQ, Optimizer
> Affects Versions: ARQ 2.9.4
> Reporter: Giovanni Mels
> Assignee: Andy Seaborne
> Labels: filter, nested, optimization, optional
> Fix For: Jena 2.11.1
>
> Attachments: simple-query.rq
>
>
> The query optimizer generates a suboptimal query plan in case of nested optionals followed by a filter (?var = <uri>).
> The problem is similar to the problem discussed here http://markmail.org/message/zy5qx47hxfo2vdlg, except we have nested optionals in our query (There are no scope problems, all optionals are translated to conditionals). It is only the filter that is translated differently:
> arq-2.8.8
> (extend ((?var <uri>))
> (conditional
> (conditional
> (conditional
> (conditional
> (conditional
> (conditional
> (bgp
> ...
>
> jena-arq-2.9.4
> (filter (= ?var <uri>)
> (conditional
> (conditional
> (conditional
> (conditional
> (conditional
> (conditional
> (bgp
> ...
> Query times went from milliseconds to over 7 minutes because of this.
> I reduced the query to this test case:
> PREFIX ex: <http://example.org/test#>
> SELECT * WHERE {
> ?var ex:p1 ?x.
>
> OPTIONAL {
> ?x ex:p2 ?y.
>
> OPTIONAL {
> ?y ex:p3 ?z
> }
> }
>
> FILTER (?var = ex:i)
> }
> (filter (= ?var <http://example.org/test#i>)
> (conditional
> (bgp (triple ?var <http://example.org/test#p1> ?x))
> (conditional
> (bgp (triple ?x <http://example.org/test#p2> ?y))
> (bgp (triple ?y <http://example.org/test#p3> ?z)))))
>
>
> The nested OPTIONAL seems to be the problem here, removing it gives
> (assign ((?var <http://example.org/test#i>))
> (conditional
> (bgp (triple <http://example.org/test#i> <http://example.org/test#p1> ?x))
> (bgp
> (triple ?x <http://example.org/test#p2> ?y)
> (triple ?y <http://example.org/test#p3> ?z)
> )))
>
> This might be related to JENA-294.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)