MongoDB virtual graph Query response time observation

Hi, I'm working with the virtual graph MongoDB, I have two instances of MongoDB running on two different machines... One of the machines has Stardog installed...
From my Stardog studio, I ran a query first time pointing to a machine that has MongoDB and Stardog.
Which means mongodb is local to stardog

 SELECT ?id ?frame { 
    GRAPH <virtual://music> { 
        ?album :schema "ab1". 
        ?album :rare "0606".
        ?album :frame ?frame .
        ?album :id ?id . 
            
        } 
    } 
    OFFSET 1 
    LIMIT 50

The result response I got was within 2 seconds.

Next, I ran the same query but this time Stardog is pointing to MongoDB which is not local to it(running on a different server).

The result response took 25 to 30 seconds...

What can be the possible reason for this? What can I do to reduce this time difference

My completely wild guess would be is that there are a large number of network round trips that aren't a problem if it's local. Can you include the query plan?

Query plan:-

Slice(offset=1, limit=50) [#50]
`─ Projection(?id, ?frame) [#21K]
   `─ Projection(?album, ?id, ?frame) [#21K]
      `─ ServiceJoin [#21K]
         +─ VirtualGraphMongoDB<virtual://music> [#10744] {
         │  +─ Query=
         │  +─    {$unwind: "$rare"},
         │  +─    { $match : {$and : [ {"rare" : {$eq : "0606"}}, {"frame" : {$exists : true, $ne : null}} ]} },
         │  +─    {$project: {frame: '$frame'} }
         │  +─ Vars=
         │  +─    ?var100 <- COLUMN($0)^^xsd:string
         │  }
         `─ ServiceJoin [#29K]
            +─ VirtualGraphMongoDB<virtual://music> [#42976] {
            │  +─ Query=
            │  +─    { $match : {$and : [ {"frame" : {$exists : true, $ne : null}}, {"id" : {$exists : true, $ne : null}} ]} },
            │  +─    {$project: {frame: '$frame', id: '$id'} }
            │  +─ Vars=
            │  +─    ?id <- COLUMN($1)^^xsd:string
            │  +─    ?var100 <- COLUMN($0)^^xsd:string
            │  }
            `─ ServiceJoin [#14K]
               +─ VirtualGraphMongoDB<virtual://music> [#47752] {
               │  +─ Query=
               │  +─    { $match : {"frame" : {$exists : true, $ne : null}} },
               │  +─    {$project: {frame: '$frame'} }
               │  +─ Vars=
               │  +─    ?frame <- COLUMN($0)^^xsd:string
               │  +─    ?var100 <- COLUMN($0)^^xsd:string
               │  }
               `─ VirtualGraphMongoDB<virtual://music> [#7162] {
                  +─ Query=
                  +─    { $match : {$and : [ {"schema" : {$eq : "ab1"}}, {"frame" : {$exists : true, $ne : null}} ]} },
                  +─    {$project: {frame: '$frame'} }
                  +─ Vars=
                  +─    ?album <- TEMPLATE(http://music1.com/album/{frame/0})
                  +─    ?var100 <- COLUMN($0)^^xsd:string
                  }

@zachary.whitley

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.