You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Elli Schwarz <el...@yahoo.com> on 2013/01/03 16:34:12 UTC

FROM vs GRAPH in Fuseki

Hello,

I've noticed that my queries perform faster in some cases when I use a FROM clause instead of GRAPH { }.

For example, in one query I noticed that 
SELECT * FROM <urn:test:mygraph> where { ... }

performs significantly better - in one case, in seconds, vs. a minute or so for the same "where" clause but with the query structured like this:
SELECT * where { GRAPH <urn:test:mygraph> { ... } }

I understand that the two queries are not really the same, but in this case (where there are no graph patterns outside of the GRAPH clause), I would expect them to perform identically. Is anyone familiar with how Fuseki works in both of these cases which would explain the difference in performance?

Thanks!

-Elli

Re: FROM vs GRAPH in Fuseki

Posted by Andy Seaborne <an...@apache.org>.
On 03/01/13 15:34, Elli Schwarz wrote:
> Hello,
>
> I've noticed that my queries perform faster in some cases when I use
> a FROM clause instead of GRAPH { }.
>
> For example, in one query I noticed that SELECT * FROM
> <urn:test:mygraph> where { ... }
>
> performs significantly better - in one case, in seconds, vs. a minute
> or so for the same "where" clause but with the query structured like
> this: SELECT * where { GRAPH <urn:test:mygraph> { ... } }
>
> I understand that the two queries are not really the same, but in
> this case (where there are no graph patterns outside of the GRAPH
> clause), I would expect them to perform identically. Is anyone
> familiar with how Fuseki works in both of these cases which would
> explain the difference in performance?

Doesn't make much sense to me.

FROM + TDB is effectively a (slightly) less efficient way to write GRAPH 
of the whole query pattern.

But how are you getting the timings?  Order matters because of caching. 
  If, say, you run SELECT-GRAPH then run SELECT-FROM on the same cold 
Fuseki server, the second will be faster because the first one slaved a 
lot of the data into memory.  If you reverse the queries, the now-second 
one should still be faster.

If it's not that, please could you describe the setup some more?

	Andy