Neo4j:具有大量数据的慢速选择操作 [英] Neo4j : Slow Selection Operation with Huge Data

查看:129
本文介绍了Neo4j:具有大量数据的慢速选择操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每次尝试从Graph随机访问节点.数据库中的节点数为24600968.以下查询

I am trying to the nodes from the Graph randomly each time. the number of nodes is 24600968 in the database. The following query

MATCH (n:Employee)
WITH n AS emp,rand() AS ids ORDER BY ids LIMIT 10

MATCH (n:Company)
WITH emp, n AS com,rand() AS ids ORDER BY ids LIMIT 10
RETURN emp.guid,com.guid

需要很长时间.时间是

Returned 10 rows in 306863 ms.

如何加快此过程.

推荐答案

  1. 运行2条单独的语句

  1. run 2 separate statements

尝试

通过一组随机ID查找节点,并检查它们是否为雇员

Lookup nodes by a random set of ids and check if they are an employee

MATCH (n) WITH count(*) as total
WITH [_ IN range(1,10000) | toInt(rand()*total)] as ids
MATCH (emp) WHERE id(emp) IN ids AND emp:Employee
RETURN emp LIMIT 10

您的查询会生成一个24M随机值的列表并对其进行排序(两次),同时还将图表中的那么多节点拉入内存(不确定您有多少内存)

Your query generates a list of 24M random values and sorts it (twice) while also pulling that many nodes from the graph into memory (not sure how much memory you have)

这篇关于Neo4j:具有大量数据的慢速选择操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆