ArangoDB slow query even with index

Viewed 74

I'm using ArangoDB version 3.9, I have a document-based collection named myCollection2. Each document in this collection has a 'likes' attribute, which is holding a float numeric value. Documents are dummy data now, where I used the following query to create it.

FOR i IN 1..998700000
  INSERT {
        title: RANDOM_TOKEN(32),
        description: RANDOM_TOKEN(32),
        by: RANDOM_TOKEN(32),
        url: CONCAT(CONCAT("http://www.",RANDOM_TOKEN(32)),".com"),
        tags: [RANDOM_TOKEN(10), RANDOM_TOKEN(10), RANDOM_TOKEN(10)],
        likes: FLOOR(RAND() * (51)),
        comments: [
            {
                user:RANDOM_TOKEN(24),
                message: RANDOM_TOKEN(100),
                dateCreated: DATE_ISO8601(946681801000 + FLOOR(RAND() * 1000000000000)),
                likes: FLOOR(RAND() * (51))
            }
        ]
    } IN myCollection2

Then I added a persistent index to the collection on the likes attribute and used the query below to find documents with some value.

FOR s in myCollection2 
    FILTER s.likes == 29.130405590990936
return s

knowing that the value 29.130405590990936 actually exists in some documents, the above query is taking about ~8 ms, which is great. However, when using some other value that doesn't actually exist, say for example 10, the query takes almost about 1 hour, which is crazy. Am I missing something here?

0 Answers
Related