如何优化orientdb查询

时间:2018-04-29 10:42:12

标签: java sql orientdb

我有两个SQL脚本,如下所示:

SQL1:

select count(*) from (MATCH {class: Dnode, as: snode, where:(name = 'uuid' and value='d8a30901a12d42a17e9050279aebccd2')}.in('Relate'){class: Event, as: event, where:(ts >= 1524844800 and ts <= 1525104000)} RETURN event)

SQL2:

MATCH {class: Dnode, as: snode, where:(name = 'uuid' and value='d8a30901a12d42a17e9050279aebccd2')}.in('Relate'){class: Event, as: event, where:(ts >= 1524844800 and ts <= 1525104000)} RETURN event

我执行SQL1的速度非常慢,差不多可达2秒。并且它不在Dnode和index_2(ts)上使用我的索引index_1(名称,值)。但我执行第二个SQL脚本,在0.052秒内执行查询,并使用我的索引。

0 个答案:

没有答案