当我像这样嵌套查询时
FOR f in friends
FOR l in locations
FILTER l.friends_id == f.id
RETURN {'friends':f, 'locations':l}(3484项结果)。
响应很慢(7到10秒之间),通过web接口和arangosh返回结果。
我关心的是:这个响应时间不是太大吗?生产数据库将比这大得多,并可能带来性能问题。
有什么想法吗?致以问候!
发布于 2014-07-17 07:56:49
我试过以下几种方法:
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“然后再试一次吗?现在更快了吗?
https://stackoverflow.com/questions/24792086
复制相似问题