Why OrientDB doesn't use indexes for searching with "LIKE" operator?
Asked Answered
D

1

5

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.

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

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?

Direct answered 28/1, 2013 at 15:47 Comment(0)
P
7

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

explain select username from P where username containstext 'log'

or try this one:

 explain select username from P where username >= 'log' and username < 'loh'
Production answered 28/1, 2013 at 17:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.