我已經試過如下:
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」並重試嗎?現在速度更快嗎?
「friend_id」未被索引!執行「ensureHashIndex」後問題解決了,謝謝! – Tarsis