2

I'm designing a DB with ArangoDB for a Web Application. I wrote the following AQL query:

FOR result
 IN Collection
 FILTER result.field != 'undefined'
 RETURN result

I added some type of index for field but query doesn't use any indexes in no way.

In your opinion what is the problem? I read that for == operator we can use hash index and for <= or similar operators skip list.

Now, what is the correct way to do the same thing?

1
  • 3
    If the != operator is used on an attribute, no index will be used. First of all, the hash indexes don't support this type of operation. For skiplists, the operation could theoretically be transformed into result.field < 'undefined' OR result.field > 'undefined', so two disjoint ranges could in theory be queried from such index. But in general, the point of using an index is to filter out as many documents as early as possible in the query, and in many cases the != will not lead to a big reduction. Commented Oct 29, 2015 at 18:02

1 Answer 1

3

(pasting my own comment from above as an answer so the question can be marked answered):

If the != operator is used on an attribute, no index will be used.

First of all, hash indexes in ArangoDB don't support this type of operation.

For skiplist indexes, the operation could theoretically be transformed into result.field < 'undefined' OR result.field > 'undefined', so two disjoint ranges could in theory be queried from such index. But in general, the point of using an index is to filter out as many documents as early as possible in the query, and in many cases the != will not lead to a big reduction

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.