Sparql 17-05-04 12:00:18.729信息:图形节点[Var this_0] 2017-05-04 12:00:18.729信息:GraphNode[IRI] 2017-05-04 12:00:18.729信息:GraphNode[IRI]]]]]]]
根据您的硬件(内存、CPU、磁盘),您可以通过增加林的数量来提高性能 MarkLogic使用横向扩展架构,因此无法保证单台机器的可扩展性能。扩展的最佳方法是添加更多节点,特别是每个节点上都有足够内存的e节点。匹配查询的结果总数有多大?如果没有按排序,性能如何?我的问题是,这基本上需要运行与图形模式匹配的整个数据。如果我删除LIMIT子句并进行计数,它将计数约29000个三倍。好的,那么删除排序器如何?这应该快得多。我感兴趣的是更好地理解这个查询和数据——如果经过良好的优化,没有理由认为它是一个运行缓慢的查询。所以我想知道我们是否需要解决一些与语法相关的小错误。我会尝试的事情--*用要返回的特定变量替换'*'用ORDER BY XIt替换ORDER BY ASC(x)似乎很愚蠢,因为这个查询很慢——考虑到您请求的排序,我不喜欢选择索引。我知道这只是在查询,看看您是否可以影响计划,但我的下一个建议是删除rdf:type谓词。我的假设是rdf:type谓词是冗余的——我可能错了。接下来,我将尝试传递一个优化参数。从内置sem:sparql调用,这将是选项“optimize=2”作为第三个参数。在REST之上,有一个参数optimize=2。此选项增加了查找最佳查询计划所花费的时间。Sparql 17-05-04 12:00:18.729信息:图形节点[Var this_0] 2017-05-04 12:00:18.729信息:GraphNode[IRI] 2017-05-04 12:00:18.729信息:GraphNode[IRI]]]]]]],sparql,marklogic,semantic-web,marklogic-8,Sparql,Marklogic,Semantic Web,Marklogic 8,根据您的硬件(内存、CPU、磁盘),您可以通过增加林的数量来提高性能 MarkLogic使用横向扩展架构,因此无法保证单台机器的可扩展性能。扩展的最佳方法是添加更多节点,特别是每个节点上都有足够内存的e节点。匹配查询的结果总数有多大?如果没有按排序,性能如何?我的问题是,这基本上需要运行与图形模式匹配的整个数据。如果我删除LIMIT子句并进行计数,它将计数约29000个三倍。好的,那么删除排序器如何?这应该快得多。我感兴趣的是更好地理解这个查询和数据——如果经过良好的优化,没有理由认为它是一个运
PREFIX gj: <http://mycompany.com/geonames-jurisdiction/1.0/schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX gn: <http://www.geonames.org/ontology#>
SELECT *
FROM <http://mycompany.com/geonames-jurisdiction/1.0/data>
FROM <http://mycompany.com/geonames-jurisdiction/1.0/rule-data>
WHERE
{ ?this_0 rdf:type gj:LocalCounty ;
gn:name ?name_1 .
}
ORDER BY ASC(?name_1)
LIMIT 100
INSERT {
GRAPH <http://mycompany.com/geonames-jurisdiction/1.0/rule-data> {
?this gj:localCountyName ?name .
}
}
WHERE {
?this a gj:LocalCounty .
?this gn:name ?name .
}
PREFIX gj: <http://mycompany.com/geonames-jurisdiction/1.0/schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX gn: <http://www.geonames.org/ontology#>
SELECT ?this_0 ?name_1
FROM <http://mycompany.com/geonames-jurisdiction/1.0/data>
FROM <http://mycompany.com/geonames-jurisdiction/1.0/rule-data>
WHERE
{ ?this_0 rdf:type gj:LocalCounty ;
gj:localCountyName ?name_1 .
}
ORDER BY ?name_1
LIMIT 20
2017-05-04 12:00:18.684 Info: <triple-value-statistics count="147540458" unique-subjects="25064012" unique-predicates="81" unique-objects="67600843" xmlns="cts:triple-value-statistics">
2017-05-04 12:00:18.684 Info: <triple-value-entries>
2017-05-04 12:00:18.684 Info: <triple-value-entry count="8385355">
2017-05-04 12:00:18.684 Info: <triple-value>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</triple-value>
2017-05-04 12:00:18.684 Info: <subject-statistics count="0" unique-predicates="0" unique-objects="0"/>
2017-05-04 12:00:18.684 Info: <predicate-statistics count="8356279" unique-subjects="8341989" unique-objects="13"/>
2017-05-04 12:00:18.684 Info: <object-statistics count="0" unique-subjects="0" unique-predicates="0"/>
2017-05-04 12:00:18.684 Info: </triple-value-entry>
2017-05-04 12:00:18.684 Info: <triple-value-entry count="29204">
2017-05-04 12:00:18.684 Info: <triple-value>http://mycompany.com/geonames-jurisdiction/1.0/schema#LocalCounty</triple-value>
2017-05-04 12:00:18.684 Info: <subject-statistics count="2" unique-predicates="2" unique-objects="2"/>
2017-05-04 12:00:18.684 Info: <predicate-statistics count="0" unique-subjects="0" unique-objects="0"/>
2017-05-04 12:00:18.684 Info: <object-statistics count="29202" unique-subjects="29202" unique-predicates="3"/>
2017-05-04 12:00:18.684 Info: </triple-value-entry>
2017-05-04 12:00:18.684 Info: <triple-value-entry count="29201">
2017-05-04 12:00:18.684 Info: <triple-value>http://mycompany.com/geonames-jurisdiction/1.0/schema#localCountyName</triple-value>
2017-05-04 12:00:18.684 Info: <subject-statistics count="0" unique-predicates="0" unique-objects="0"/>
2017-05-04 12:00:18.684 Info: <predicate-statistics count="29201" unique-subjects="29201" unique-objects="26692"/>
2017-05-04 12:00:18.684 Info: <object-statistics count="0" unique-subjects="0" unique-predicates="0"/>
2017-05-04 12:00:18.684 Info: </triple-value-entry>
2017-05-04 12:00:18.684 Info: </triple-value-entries>
2017-05-04 12:00:18.684 Info: </triple-value-statistics>
2017-05-04 12:00:18.684 Info: [Event:id=SPARQL AST] sessionKey=7777437449602930525
2017-05-04 12:00:18.684 Info: initialPlan=SPARQLModule[
2017-05-04 12:00:18.684 Info: Prolog[]
2017-05-04 12:00:18.684 Info: SPARQLSelect[SPARQLLimit[
2017-05-04 12:00:18.684 Info: LIMIT GraphNode[Literal "20"^^<http://www.w3.org/2001/XMLSchema#integer>]
2017-05-04 12:00:18.684 Info: SPARQLProject[order(1)
2017-05-04 12:00:18.684 Info: GraphNode[Var this_0 0]
2017-05-04 12:00:18.684 Info: GraphNode[Var name_1 1]
2017-05-04 12:00:18.684 Info: SPARQLOrder[order(1) UNSORTED
2017-05-04 12:00:18.684 Info: OrderSpec[
2017-05-04 12:00:18.684 Info: Variable[QName[(Unknown) name_1] 1]
2017-05-04 12:00:18.684 Info: ASCENDING EMPTY MIN]
2017-05-04 12:00:18.684 Info: SPARQLMergeJoin[order(0) hash(0==0) scatter()
2017-05-04 12:00:18.684 Info: TriplePattern[order(0,1) PSO
2017-05-04 12:00:18.684 Info: GraphNode[Var this_0 0]
2017-05-04 12:00:18.684 Info: GraphNode[IRI <http://mycompany.com/geonames-jurisdiction/1.0/schema#localCountyName>]
2017-05-04 12:00:18.684 Info: GraphNode[Var name_1 1]]
2017-05-04 12:00:18.684 Info: TriplePattern[order(0) OPS
2017-05-04 12:00:18.684 Info: GraphNode[Var this_0 0]
2017-05-04 12:00:18.684 Info: GraphNode[IRI <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>]
2017-05-04 12:00:18.684 Info: GraphNode[IRI <http://mycompany.com/geonames-jurisdiction/1.0/schema#LocalCounty>]]]]]]]]
2017-05-04 12:00:18.684 Info: [Event:id=SPARQL Cost Analysis] sessionKey=7777437449602930525 optimize=1 r=3 t=1.28811 os=360 is=15 mutations=9 seed=15212683942933123635
2017-05-04 12:00:18.684 Info: initialCost=(m:6.02656e+07,r:0,io:(52.931/1.20414e+07/0),cpu(2):(0/116805/0),mem:87603,c:20,crd:[20,20])
2017-05-04 12:00:18.726 Info: [Event:id=SPARQL Cost Analysis] sessionKey=7777437449602930525 diff=0 diff%=0 r=0
2017-05-04 12:00:18.726 Info: cost=(m:6.02656e+07,r:0,io:(52.931/1.20414e+07/0),cpu(2):(0/116805/0),mem:87603,c:20,crd:[20,20])
2017-05-04 12:00:18.726 Info: [Event:id=SPARQL Cost Analysis] sessionKey=7777437449602930525 diff=0 diff%=0 r=1
2017-05-04 12:00:18.726 Info: cost=(m:6.02656e+07,r:0,io:(52.931/1.20414e+07/0),cpu(2):(0/116805/0),mem:87603,c:20,crd:[20,20])
2017-05-04 12:00:18.728 Info: [Event:id=SPARQL Cost Analysis] sessionKey=7777437449602930525 diff=0 diff%=0 r=2
2017-05-04 12:00:18.728 Info: cost=(m:6.02656e+07,r:0,io:(52.931/1.20414e+07/0),cpu(2):(0/116805/0),mem:87603,c:20,crd:[20,20])
2017-05-04 12:00:18.728 Info: [Event:id=SPARQL Cost Analysis] sessionKey=7777437449602930525
2017-05-04 12:00:18.728 Info: bestCost=(m:6.02656e+07,r:0,io:(52.931/1.20414e+07/0),cpu(2):(0/116805/0),mem:87603,c:20,crd:[20,20])
2017-05-04 12:00:18.729 Info: [Event:id=SPARQL AST] sessionKey=7777437449602930525
2017-05-04 12:00:18.729 Info: plan=SPARQLModule[
2017-05-04 12:00:18.729 Info: Prolog[]
2017-05-04 12:00:18.729 Info: SPARQLSelect[SPARQLLimit[
2017-05-04 12:00:18.729 Info: LIMIT GraphNode[Literal "20"^^<http://www.w3.org/2001/XMLSchema#integer>]
2017-05-04 12:00:18.729 Info: SPARQLProject[order(1)
2017-05-04 12:00:18.729 Info: GraphNode[Var this_0 0]
2017-05-04 12:00:18.729 Info: GraphNode[Var name_1 1]
2017-05-04 12:00:18.729 Info: SPARQLOrder[order(1) UNSORTED
2017-05-04 12:00:18.729 Info: OrderSpec[
2017-05-04 12:00:18.729 Info: Variable[QName[(Unknown) name_1] 1]
2017-05-04 12:00:18.729 Info: ASCENDING EMPTY MIN]
2017-05-04 12:00:18.729 Info: SPARQLMergeJoin[order(0) hash(0==0) scatter()
2017-05-04 12:00:18.729 Info: TriplePattern[order(0,1) PSO
2017-05-04 12:00:18.729 Info: GraphNode[Var this_0 0]
2017-05-04 12:00:18.729 Info: GraphNode[IRI <http://mycompany.com/geonames-jurisdiction/1.0/schema#localCountyName>]
2017-05-04 12:00:18.729 Info: GraphNode[Var name_1 1]]
2017-05-04 12:00:18.729 Info: TriplePattern[order(0) OPS
2017-05-04 12:00:18.729 Info: GraphNode[Var this_0 0]
2017-05-04 12:00:18.729 Info: GraphNode[IRI <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>]
2017-05-04 12:00:18.729 Info: GraphNode[IRI <http://mycompany.com/geonames-jurisdiction/1.0/schema#LocalCounty>]]]]]]]]