首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用java分析neo4j数据库命中

使用java分析neo4j数据库命中
EN

Stack Overflow用户
提问于 2017-02-03 20:20:46
回答 1查看 85关注 0票数 1

我正在尝试使用以下代码分析neo4j数据库的命中率

代码语言:javascript
复制
public int calculateHits(List<ExecutionPlanDescription> list) {
    int hits = 0;
    int head = 0;
    if (list.isEmpty())
        return 0;

    if (list.get(head).hasProfilerStatistics()) {
        hits += list.get(head).getProfilerStatistics().getDbHits();
        System.out.println(hits);
    }
    hits += calculateHits(list.get(head).getChildren()); // recurse over the children of the head
    list.remove(head); // remove the head to recurse on the remaining of the list
    hits += calculateHits(list);
    return hits;
}

在main中,我这样称呼它

代码语言:javascript
复制
Result result = neo4jGraph.execute(query);

int hits = calculateHits(result.getExecutionPlanDescription().getChildren()); 

但是,该方法始终返回0次命中。我记录了queryExecuter计划的名称并找到了EagerAggregation和Filter。展开(全部)、筛选和NodeByLabelScan计划。但似乎并不是所有的计划都存在profilerStatistics,因为它从不访问条件并增加命中率。

是否在代码中有任何问题,或者我需要首先进行某些配置,以分析数据库命中?感谢你的帮助。谢谢!

EN

回答 1

Stack Overflow用户

发布于 2017-08-09 19:21:18

我终于找到问题所在了!我必须在查询中使用profile来填充统计数据并获得数据库命中率。因此,查询应该是

代码语言:javascript
复制
PROFILE Match (e:Event)-[r:has_metadata]-> (s:EventMetadata) where s.type STARTS WITH 'ELec' AND s.eventLocation IN ["GW", "GW32", "FW", "FW29" , "SW", "SW00"] AND e.date="1/11/2016" return SUM( e.reading)}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42024195

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档