Hi,
I need your help!

I am try to query my db using two different queries.

the first is:


FOR doc1 in catalogue
FOR doc2 in RepoNodes


 FILTER doc1.trackid>= "TRAAAAK128F9318786" AND   doc1.trackid<= 
"TRAACER128F4290F96" AND doc1.trackid==doc2.mongodbsongs


 FOR doc3 in RepoEdges
  FILTER doc3._from==doc2._id
  FOR doc4 in RepoNodes
  FILTER doc3._to ==doc4._id

      FOR doc5 in RepoEdges
      FILTER doc5._from==doc4._id
       FOR doc6 in RepoNodes
     FILTER doc6._id ==doc5._to


        FOR doc7 in RepoEdges
      FILTER doc7._from==doc6._id
       FOR doc8 in RepoNodes
     FILTER doc8._id ==doc7._to




   FOR doc10 in catalogue
     FILTER doc10.trackid== doc8.mongodbsongs
    FOR doc11 in similarities
      FILTER doc11._from==CONCAT("Tracks/",doc8.neo4jSong)
      FOR doc12 in clearance
        FILTER doc8.redisclearance== doc12._key
         return {doc10,doc11,doc12}



where I apply Filters a lot of times, and it's ok, because I can get 
results and the search uses Indexes..
In the explain of this I see:

  1   SingletonNode                       1   * ROOT
 45   IndexNode                      111882     - FOR doc1 IN catalogue   /* 
skiplist index scan */
 44   IndexNode                  4693561782       - FOR doc2 IN RepoNodes   /* 
skiplist index scan */
 46   CalculationNode            4693561782         - LET #11 = 
((doc1.`trackid` >= "TRAAAAK128F9318786") && (doc1.`trackid` <= 
"TRAACER128F4290F96"))   /* simple expression */   /* collections used: 
doc1 : catalogue */
  5   FilterNode                 4693561782         - FILTER #11
 43   IndexNode                 42242056038         - FOR doc3 IN RepoEdges 
  /* edge index scan */
 42   IndexNode                 42242056038           - FOR doc4 IN 
RepoNodes   /* primary index scan */
 41   IndexNode                380178504342             - FOR doc5 IN 
RepoEdges   /* edge index scan */
 40   IndexNode                380178504342               - FOR doc6 IN 
RepoNodes   /* primary index scan */
 39   IndexNode               3421606539078                 - FOR doc7 IN 
RepoEdges   /* edge index scan */
 38   IndexNode               3421606539078                   - FOR doc8 IN 
RepoNodes   /* primary index scan */
 37   IndexNode          143556923953556580                     - FOR doc10 
IN catalogue   /* skiplist index scan */
 36   IndexNode         1722683087442678800                       - FOR 
doc11 IN similarities   /* edge index scan */
 35   IndexNode         1722683087442678800                         - FOR 
doc12 IN clearance   /* primary index scan */


Why it's impossible to do the same with a query like this:

FOR doc1 in catalogue
FOR doc2 in RepoNodes
 FOR doc3 in RepoEdges
 FOR doc4 in RepoNodes
   FOR doc5 in RepoEdges
          FOR doc6 in RepoNodes
            FOR doc10 in catalogue
             FOR doc11 in similarities
              FOR doc12 in clearance
 
 FILTER doc1.trackid== "TRAAAAK128F9318786" AND 
doc1.trackid==doc2.mongodbsongs
AND doc3._from==doc2._id AND doc3._to ==doc4._id AND doc5._from==doc4._id 
and    doc6._id ==doc5._to
AND   doc10.trackid== doc6.mongodbsongs
AND doc11._from==CONCAT("Tracks/",doc6.neo4jSong)
AND doc6.redisclearance== doc12._key
         return {doc10,doc11,doc12}

It's the same query but with only one filter for the conditions, and this 
causes a FULL COLLECTION SCAN for any of the collections.
why this happens?

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to