vendredi 7 juillet 2017

Cypher: Match random node in Neo4j

I have a database with 3.4 millions of nodes and want to select a random node.

I tried using something like MATCH (n) WHERE rand() <= 0.01 RETURN n LIMIT 1, but it seems like the algorithm always starts with the same nodes and selects the first one whose random number is below 0.01, which means in most cases the "random" node is one of the first 100 checked nodes.

Is there a better query, to select a completely random one of all my nodes?




Aucun commentaire:

Enregistrer un commentaire