Hi Mirko,

Running similar queries with  ORDER BY and LiMIT query modifier against my 
Virtuoso 5.0.12 build and do not observe the behaviour you report. What 
Virtuoso release are you testing against ?

Also, can you provide the output of running the explain () function which 
describes the query compilation and may provide some indication as to why the 
query with 2 graphs is taking so long, see:

        http://docs.openlinksw.com/virtuoso/fn_explain.html

Note you will need to run this command using the isql command line query tool 
and prepend them with the "SPARQL" keyword for execution, as :

explain(' SPARQL SELECT ?description FROM <http://localhost/graphA> WHERE {  
?recource <http://purl.org/dc/terms/subject> <http://localhost/someElement> .  
?recource <http://purl.org/dc/terms/subject> ?relatedElement . ?relatedElement 
<http://purl.org/dc/terms/description> ?description .  ?relatedElement 
<http://localhost/score> ?score } ORDER BY DESC (?score) LIMIT 4');

query B (times out):

explain(' SPARQL SELECT ?description FROM <http://localhost/graphA> FROM 
<http://localhost/graphB> WHERE {  ?recource <http://purl.org/dc/terms/subject> 
<http://localhost/someElement> .  ?recource <http://purl.org/dc/terms/subject> 
?relatedElement . ?relatedElement <http://purl.org/dc/terms/description> 
?description .  ?relatedElement <http://localhost/score> ?score } ORDER BY DESC 
(?score) LIMIT 4');

Note you can also try increasing the SPARQL query time outs in the Virtuoso 
configuration file (virtuoso.ini) which would enable the query to run:

[SPARQL]
;ExternalQuerySource            = 1
;ExternalXsltSource             = 1
;ResultSetMaxRows               = 1
;DefaultGraph                   = http://localhost:8891/testgraph
MaxQueryCostEstimationTime      = 200 ; in seconds
MaxQueryExecutionTime           = 100 ; in seconds
;ImmutableGraphs                = http://localhost:8890/dataspace
;PingService                    = http://rpc.pingthesemanticweb.com/
;DefaultQuery                   = select * where { ?s ?p ?o . }

But we still need to determine why the query execution time is so long ...

Best Regards
Hugh Williams
Professional Services
OpenLink Software
Web: http://www.openlinksw.com
Support: http://support.openlinksw.com
Forums: http://boards.openlinksw.com/support
Twitter: http://twitter.com/OpenLink

On 20 Nov 2009, at 09:30, Mirko wrote:

> Hi,
> I have a SPARQL query which performes well when querying a single graph but 
> "the estimated execution time exceeds the time limit of 400 (secs)" when 
> querying two graphs. This is also true if the second graph is empty. Why is 
> this the case / how can I fix this?
> 
> Query A (performes well):
> 
> SELECT ?description FROM <http://localhost/graphA> WHERE {  ?recource 
> <http://purl.org/dc/terms/subject> <http://localhost/someElement> .  
> ?recource <http://purl.org/dc/terms/subject> ?relatedElement . 
> ?relatedElement <http://purl.org/dc/terms/description> ?description .  
> ?relatedElement <http://localhost/score> ?score } ORDER BY DESC (?score) 
> LIMIT 4
> 
> query B (times out):
> 
> SELECT ?description FROM <http://localhost/graphA> FROM 
> <http://localhost/graphB> WHERE {  ?recource 
> <http://purl.org/dc/terms/subject> <http://localhost/someElement> .  
> ?recource <http://purl.org/dc/terms/subject> ?relatedElement . 
> ?relatedElement <http://purl.org/dc/terms/description> ?description .  
> ?relatedElement <http://localhost/score> ?score } ORDER BY DESC (?score) 
> LIMIT 4
> 
> -->"The estimated execution time 664 (sec) exceeds the limit of 400 (sec)."
> 
> Regards, 
> -Mirko
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Virtuoso-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to