Reputation: 101
when i do nested query like this
FOR f in friends
FOR l in locations
FILTER l.friends_id == f.id
RETURN {'friends':f, 'locations':l}
(3484 results).
the response is slow (between 7 to 10 seconds) return results via the web interface and arangosh
My concern: this response time is not too big? the production database will much greater than that, and can bring performance problems.
Any idea? Regards!
Upvotes: 2
Views: 309
Reputation: 2764
I've tried the following:
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}")
This will return 1000 records quite fast.
Can you execute the "ensureHashIndex" and try again? Is it now faster?
Upvotes: 2