为什么OrientDB不使用索引来搜索“LIKE”运算符?

时间:2021-05-03 20:10:52

I found that OrientDB is too slow (at least much slower than Neo4j) even on relatively small (150K) datasets when searching records by text pattern despite the presence of indices.

我发现即使在相对较小的(150K)数据集中,尽管存在索引,但是在按文本模式搜索记录时,OrientDB太慢(至少比Neo4j慢得多)。

For example I have both UNIQUE and FULLTEXT indexes for the "username" property but as show below OrientDB doesn't use any.

例如,我有“username”属性的UNIQUE和FULLTEXT索引,但是如下所示,OrientDB不使用任何索引。

orientdb> explain select username from P where username like 'log%'    

Profiled command '{current:#10:152060,documentReads:152061,documentAnalyzedCompatibleClass:152061,recordReads:152061,elapsed:6.5357623,resultType:collection,resultSize:88}' in 6,537000 sec(s):
{
  "@type": "d", "@version": 0, 
  "current": "#10:152060", 
  "documentReads": 152061, 
  "documentAnalyzedCompatibleClass": 152061, 
  "recordReads": 152061, 
  "elapsed": 6.5357623, 
  "resultType": "collection", 
  "resultSize": 88, 
  "@fieldTypes": "documentReads=l,documentAnalyzedCompatibleClass=l,recordReads=l,elapsed=f"
}

It there any way to speed up pattern search in OrientDB?

有没有办法加速OrientDB中的模式搜索?

1 个解决方案

#1


7  

In order to use the full-text index you should use the containstext operator, like:

要使用全文索引,您应该使用containstext运算符,如:

explain select username from P where username containstext 'log'

or try this one:

或尝试这个:

 explain select username from P where username >= 'log' and username < 'loh'

#1


7  

In order to use the full-text index you should use the containstext operator, like:

要使用全文索引,您应该使用containstext运算符,如:

explain select username from P where username containstext 'log'

or try this one:

或尝试这个:

 explain select username from P where username >= 'log' and username < 'loh'