Uploaded image for project: 'Spring Tool Suite'
  1. Spring Tool Suite
  2. STS-3815

Query Execution Time Growing Each Time It Is Run



    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 3.4.0.RELEASE
    • None
    • DATA


      I am using the Spring Data Mongo API query methods to store and fetch POJOs in and out of MongoDB. While the query execution times seem slow for the number of documents I am fetching, the more troubling problem is the growth in the execution time with each query. For example, I call the Mongo repository method "pojoRepository.findAll()" and its returns 44 documents in roughly 2.5 ms. When I run the same exact query again it takes ~7.2 ms. The next execution increases by about the same about ending up a little less than 13 ms. The next runs in ~18 ms, and so on and so on. If there are only 22 documents to fetch, the growth factor is smaller and likewise, if there are 66 documents the growth factor is larger.

      I have eliminated MongoDB as the mongo client runs the same query in sub-second time, every time. I have tried using the Cacheable annotation API but, there is no effect, I assume because I am fetching ALL documents where the Cacheable functionality seems to depend on and leverage a field (preferably indexed) as query filter criteria. I was going to try different versions of Java but, thought I would post this problem in the meantime to see if anyone has any ideas about what's going on.




            Unassigned Unassigned
            trobinson Tracy Robinson
            0 Vote for this issue
            2 Start watching this issue