Tom P.
Tom P.

Reputation: 400

Optimizing Redis-Graph query performance (match)

I want to save a large graph in Redis and was trying to accomplish this using RedisGraph. To test this I was creating a test-graph first to check the performance characteristics. The graph is rather small for the purposes we need.

And this is very limited for our purposes, we would need to be able to increase this to 100's of millions of edges in a single database. In any case, I was checking space and performance requirements buit stopped after only loading in the vertices and seeing that the performance for a:

GRAPH.QUERY gid 'MATCH (t:token {token: "some-string"}) RETURN t' 

Is over 300 milliseconds for just this retrieval which is absolutely unacceptable.

Am I missing an obvious way to improve the retrieval performance, or is that currently the limit of RedisGraph?

Thanks

Upvotes: 3

Views: 1437

Answers (2)

SWilly22
SWilly22

Reputation: 879

In case all nodes are labeled as "token" then redisgraph will have to scan 3.5 million entities, comparing each entity "token" attribute against the value you've provided ("some-string")

for speed up I would recommend either adding an index, or limiting the number of results you would like to receive using LIMIT.

Also worth mentioning is that the first query to be served might take awhile longer then following queries due to internal memory management.

Upvotes: 5

Alister Bulman
Alister Bulman

Reputation: 35169

Adding an index will speed things up a lot when matching.

CREATE INDEX ON :token(token)

From my investigations, I think that at least one instance of the item must exist for an index to be created, but I've not done any numbers on extra overhead of creating the index early and then adding most of the new nodes, rather than after all items are in the tree and they can be indexed en-mass.

Upvotes: 5

Related Questions