HI,all
I Found something interesting, The test as follow:
public static void main(String args[]) {
GraphDatabaseService db = new EmbeddedGraphDatabase("testDB");
indexService = new LuceneIndexService(db);
Long startTime = System.currentTimeMillis();
for(int i =0 ;i <10000;i++){
Node node = getNodeByIndexProperty(db,String.valueOf(i));
}
Long endTime = System.currentTimeMillis();
System.out.println("time = " + (endTime - startTime));
}
public static Node getNodeByIndexProperty(GraphDatabaseService db, String
keyValue) {
// Node node = indexService.getSingleNode(KEY_NAME, keyValue);
Node node = db.getNodeById(Long.valueOf(keyValue));
return node;
}
When I try to use the method indexService.getSingleNode...... with 9999 times,
It will take 2 seconds (nearly) , BY when I use db.getNodeById.... same times,
It just take 350 millisecond . Does it mean getById is faster than use index ?
or Does that mean the natural index is better than index if I can use it ?
thanks for your help ,and replies, that help me very much!
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user