Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2337

Investigate whether to cache multi-batch queries

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      For example, given a collection with 10k documents:

      Mongo::QueryCache.enabled=true
      client['foo'].insert_many((1...10_000).map{|i|{test:i}})
      

      If we perform a find with a 10k result set, but only retrieve 10 documents, the finds are currently not cached:

      b=client['foo'].find.sort(test:1).to_enum
      10.times  { b.next }
      
      b=client['foo'].find.sort(test:1).to_enum
      10.times  { b.next }
      

      Open questions:

      • Should multi-batch finds this be cached when the cursor is not completely iterated?
      • What if the first iteration completely consumes the first batch (i.e. iterates 1000 documents in default configuration instead of 10), should the second iteration read the 10 documents out of the cache populated by the first iteration?

      If multi-batch queries are never cached, this should be noted in the user guide.

            Assignee:
            emily.giurleo@mongodb.com Emily Giurleo (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: