You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GraphDB中onto:measure的时间单位、总执行时间及相关资料咨询

GraphDB中onto:measure相关问题解答

时间单位说明

onto:measure返回的时间单位是毫秒(ms),从示例中执行时间的数值(如1、203)也能对应上这个量级,这是GraphDB性能统计的标准时间单位。

总执行时间与各步骤时间的关系

总查询执行时间不是各步骤totalTime的简单总和:

  • 各步骤的totalTime包含自身执行时间(ownTime)和依赖的外部操作时间(externalTime),不同步骤的externalTime可能存在重复计算的部分(比如共享的索引查询、数据加载操作)
  • 步骤之间存在依赖关系,后续步骤基于前面步骤的结果执行,部分计算逻辑会被复用,直接相加会高估实际总耗时
  • 实际总执行时间以GraphDB查询控制台显示的整体耗时为准,onto:measure的各步骤时间主要用于定位查询中的性能瓶颈

onto:measure的更多学习途径

  • 查看GraphDB本地安装目录下的查询优化文档:在docs文件夹的Query Optimization章节中,有关于onto:measure的使用场景和执行计划分析的详细说明
  • 利用GraphDB查询编辑器的Explain功能:将带onto:measure的查询执行后,结合Explain输出的执行计划,对比理解各步骤的性能数据含义
  • 参考GraphDB官方示例数据集的查询案例:比如GTFS、LUBM等示例数据中,包含带性能分析的查询示例,可以学习如何通过onto:measure定位和优化慢查询

带onto:measure的示例查询

PREFIX onto: <http://www.ontotext.com/>
PREFIX gtfs: <http://vocab.gtfs.org/terms#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
SELECT * FROM onto:measure{
?shape a gtfs:Shape .
?shape gtfs:shapePoint ?shapePoint.
?shapePoint geo:lat ?shape_pt_lat .
?shapePoint geo:long ?shape_pt_lon .
?shapePoint gtfs:pointSequence ?shape_pt_sequence .
}

执行计划输出示例

PREFIX gtfs: <http://vocab.gtfs.org/terms#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?shape ?shapePoint ?shape_pt_lat ?shape_pt_lon ?shape_pt_sequence
{

  { # ----- Begin optimization group 1 -----

    ?shape rdf:type gtfs:Shape . #  Collection size: 956    Predicate collection size: 1,462,787    Unique subjects: 1,462,619  Unique objects: 23  Current complexity: 956
     # EXECUTION: (count:956     totalTime:1       minTime:0       maxTime:0       ownTime:0       externalTime:0)

    ?shape gtfs:shapePoint ?shapePoint . #  Collection size: 354,750    Predicate collection size: 354,750  Unique subjects: 956    Unique objects: 354,750 Current complexity: 354,750
     # EXECUTION: (count:354750  totalTime:203     minTime:0       maxTime:0       ownTime:62      externalTime:140)

    ?shapePoint geo:lat ?shape_pt_lat . #   Collection size: 362,156    Predicate collection size: 362,156  Unique subjects: 362,156    Unique objects: 29,254  Current complexity: 354,750
     # EXECUTION: (count:354750  totalTime:183     minTime:0       maxTime:0       ownTime:61      externalTime:121)

    ?shapePoint geo:long ?shape_pt_lon . #  Collection size: 362,156    Predicate collection size: 362,156  Unique subjects: 362,156    Unique objects: 40,138  Current complexity: 354,750
     # EXECUTION: (count:354750  totalTime:207     minTime:0       maxTime:1       ownTime:62      externalTime:145)

    ?shapePoint gtfs:pointSequence ?shape_pt_sequence . #   Collection size: 354,750    Predicate collection size: 354,750  Unique subjects: 354,750    Unique objects: 1,087   Current complexity: 354,750
     # EXECUTION: (count:354750  totalTime:215     minTime:0       maxTime:1       ownTime:64      externalTime:150)


  } # ----- End optimization group 1 -----
  # ESTIMATED NUMBER OF ITERATIONS: 354,750

}

# NOTE: Optimization groups are evaluated one after another exactly in the given order.
# If there are too many optimization groups consisting of a single statement pattern,
# then one should try to relocate the following clauses by hand:
# VALUES, BIND, OPTIONAL, property paths with '*' and/or '+' (the latter can be also surrounded with brackets).
# Sub-SELECTs will always be evaluated first.

内容的提问来源于stack exchange,提问作者Darkos32

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 20:00:06