在进行了一些小的修改后,我尝试了这里给出的示例——主要是我添加了一个没有匹配的 where 子句——用于实验目的。
在我的系统(1.9.M04 - java 6u43 - ubuntu 12.04 - AMD phenom II -X6 1090T )上的简单查询
数据库中只有 1 个节点(也是嵌入的)需要 262 毫秒。显然出了点问题。可能是什么问题呢 ?
谢谢
public void test()
{
GraphDatabaseService db = g = new GraphDatabaseFactory().newEmbeddedDatabase("./neo4j1test" );
long id;
Transaction tx = db.beginTx();
try
{
Node refNode = db.createNode();
id = refNode.getId();
refNode.setProperty( "name", "reference node" );
tx.success();
}
finally
{
tx.finish();
}
ExecutionEngine engine = new ExecutionEngine( db );
ExecutionResult result = engine.execute( "start n=node("+id+") where ( n.name = \"reference node\") return n.name" );
long time = System.currentTimeMillis();
result = engine.execute( "start n=node("+id+") where ( n.name = \"reference node\") return n.name" );
time = (System.currentTimeMillis() - time);
System.out.println("Time taken : " + time + " ms.");
}