java如何优化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(名称、值)。但是我在0.052秒内执行第二个SQL脚本query execute,它使用我的索引
共 (0) 个答案