首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AQL慢反应的Arangodb反应

AQL慢反应的Arangodb反应
EN

Stack Overflow用户
提问于 2014-07-16 22:45:38
回答 1查看 248关注 0票数 2

当我像这样嵌套查询时

代码语言:javascript
复制
FOR f in friends 
  FOR l in locations 
     FILTER l.friends_id == f.id
RETURN {'friends':f, 'locations':l}

(3484项结果)。

响应很慢(7到10秒之间),通过web接口和arangosh返回结果。

我关心的是:这个响应时间不是太大吗?生产数据库将比这大得多,并可能带来性能问题。

有什么想法吗?致以问候!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-07-17 07:56:49

我试过以下几种方法:

代码语言:javascript
复制
arangosh [_system]> db._create("users");
[ArangoCollection 1252513721, "users" (type document, status loaded)]

arangosh [_system]> db._create("locations");
[ArangoCollection 1252644793, "locations" (type document, status loaded)]

arangosh [_system]> db._query("FOR i IN 1 .. 10000 INSERT { 'id': i, 'name': 'Name' } INTO users").toArray()
[ ]

arangosh [_system]> db._query("FOR i IN 1 .. 10000 INSERT { 'friends_id': i, 'name': 'Name' } INTO  locations").toArray()
[ ]

arangosh [_system]> db.locations.ensureHashIndex("friends_id")

var a = db._query("FOR f IN users FOR l IN locations FILTER l.friends_id == f.id RETURN { 'u': f, 'l': l}")

这将很快返回1000条记录。

你能执行"ensureHashIndex“然后再试一次吗?现在更快了吗?

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24792086

复制
相关文章

相似问题

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