Uploaded image for project: 'Spring Data MongoDB'
  1. Spring Data MongoDB
  2. DATAMONGO-994

QueryDsl findAll(Predicate, Pageable) is expensive

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Works as Designed
    • Affects Version/s: 1.5.1 (Dijkstra SR1)
    • Fix Version/s: None
    • Component/s: Repository
    • Labels:
      None
    • Sprint:
      51 - Dijkstra SR2

      Description

      Page<T> findAll(Predicate, Pageable) is first doing a count query (to get total count for the Page). Then the actual query is performed.

      Querydsl MongodbQuery.java#list() method is used in spring data mongodb code. This method call cursor.size() to construct ArrayList<>(). cursor.size() seems to be making an additional count query call. What looks like a simple findAll(…) call is translating into multiple count queries before the actual query is called.

      I opened a bug against querydsl https://github.com/querydsl/querydsl/issues/856

      I also opened a improvement for spring-data-commons to add a findAll(Predicate, Pageable) that returns Slice so that all count calls can be avoided.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                olivergierke Oliver Gierke
                Reporter:
                spasam Seshu Pasam
                Last updater:
                Seshu Pasam
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: