Hi, I have two very similar queries on the same local graph but their performances are very different. QUERY1 works very well and returns its results quickly while QUERY2 seems to hang. The EXPLAIN output seems to indicate that the queries are being processed in quite different ways but I'm not sure how to interpret it. I'm trying to understand what is going on and how to make QUERY2 work as well as QUERY1. Any advice would be truly appreciated. TIA Corey
QUERY1: prefix uni: <http://purl.uniprot.org/core/> select * from <http://graphserver.x.com/UNIPROT> where { ?s uni:recommendedName ?recnameid. ?recnameid uni:fullName ?recname. FILTER (regex(?s,'http://purl.uniprot.org/uniprot/Q8MIS5')) } Query 2: prefix uni: <http://purl.uniprot.org/core/> select * from <http://graphserver.x.com/UNIPROT> where { ?s uni:alternativeName ?altnameid. ?altnameid uni:cdAntigenName ?altname. FILTER (regex(?s,'http://purl.uniprot.org/uniprot/Q8MIS5')) } EXPLAIN of QUERY1 Precode: 0: $25 "com/UNIPROT" := Call __i2idn (<constant (http://graphserver.x.com/UNIPROT)>) 5: $26 "org/core/recommendedName" := Call __i2idn (<constant (http://purl.uniprot.org/core/recommendedName)>) 10: $27 "org/core/fullName" := Call __i2idn (<constant (http://purl.uniprot.org/core/fullName)>) 15: BReturn 0 from DB.DBA.RDF_QUAD by RDF_QUAD 0.00026 rows Key RDF_QUAD ASC ($30 "s-1-1-t0.S", $29 "s-1-1-t0.O") inlined <col=520 G = $25 "com/UNIPROT"> row specs: <col=523 O LIKE <constant (T�)>> , <col=522 P = $26 "org/core/recommendedName"> Current of: <$32 "<DB.DBA.RDF_QUAD s-1-1-t0>" spec 5> After test: 0: $33 "callret" := Call __id2i ($30 "s-1-1-t0.S") 5: $34 "callret" := Call rdf_regex_impl ($33 "callret", <constant (http://purl.uniprot.org/uniprot/Q8MIS5)>) 10: if (<constant (0)> 1(=) $34 "callret") then 14 else 13 unkn 14 13: BReturn 1 14: BReturn 0 Precode: 0: $35 "p" := Call __id2i ($30 "s-1-1-t0.S") 5: $36 "recnameid" := Call __ro2sq ($29 "s-1-1-t0.O") 10: BReturn 0 from DB.DBA.RDF_QUAD by RDF_QUAD 0.4 rows Key RDF_QUAD ASC ($38 "s-1-1-t1.O") inlined <col=520 G = $25 "com/UNIPROT"> , <col=521 S = $29 "s-1-1-t0.O"> , <col=522 P = $27 "org/core/fullName"> Current of: <$40 "<DB.DBA.RDF_QUAD s-1-1-t1>" spec 5> After code: 0: $41 "recname" := Call __ro2sq ($38 "s-1-1-t1.O") 5: BReturn 0 Select ($35 "p", $36 "recnameid", $41 "recname", <$40 "<DB.DBA.RDF_QUAD s-1-1-t1>" spec 5>, <$32 "<DB.DBA.RDF_QUAD s-1-1-t0>" spec 5>) } EXPLAIN QUERY2 { Precode: 0: $25 "com/UNIPROT" := Call __i2idn (<constant (http://graphserver.x.com/UNIPROT)>) 5: $26 "org/core/alternativeName" := Call __i2idn (<constant (http://purl.uniprot.org/core/alternativeName)>) 10: $27 "org/core/cdAntigenName" := Call __i2idn (<constant (http://purl.uniprot.org/core/cdAntigenName)>) 15: BReturn 0 from DB.DBA.RDF_QUAD by RDF_QUAD 6.8e-05 rows Key RDF_QUAD ASC ($30 "s-1-1-t1.S", $29 "s-1-1-t1.O") inlined <col=520 G = $25 "com/UNIPROT"> row specs: <col=522 P = $27 "org/core/cdAntigenName"> Current of: <$32 "<DB.DBA.RDF_QUAD s-1-1-t1>" spec 5> Precode: 0: $33 "altname" := Call __ro2sq ($29 "s-1-1-t1.O") 5: BReturn 0 from DB.DBA.RDF_QUAD by RDF_QUAD 1.4e-10 rows Key RDF_QUAD ASC ($36 "s-1-1-t0.S", $35 "s-1-1-t0.O") inlined <col=520 G = $25 "com/UNIPROT"> row specs: <col=523 O = $30 "s-1-1-t1.S"> , <col=523 O LIKE <constant (T�)>> , <col=522 P = $26 "org/core/alternativeName"> Current of: <$38 "<DB.DBA.RDF_QUAD s-1-1-t0>" spec 5> After test: 0: $39 "callret" := Call __id2i ($36 "s-1-1-t0.S") 5: $40 "callret" := Call rdf_regex_impl ($39 "callret", <constant (http://purl.uniprot.org/uniprot/Q8MIS5)>) 10: if (<constant (0)> 1(=) $40 "callret") then 14 else 13 unkn 14 13: BReturn 1 14: BReturn 0 After code: 0: $41 "p" := Call __id2i ($36 "s-1-1-t0.S") 5: $42 "altnameid" := Call __ro2sq ($35 "s-1-1-t0.O") 10: BReturn 0 Select ($41 "p", $42 "altnameid", $33 "altname", <$38 "<DB.DBA.RDF_QUAD s-1-1-t0>" spec 5>, <$32 "<DB.DBA.RDF_QUAD s-1-1-t1>" spec 5>) }