Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LimitOffsetPagedList add getTotalCount cache #3370

Closed
spinachomes opened this issue Mar 25, 2024 · 1 comment · Fixed by #3373
Closed

LimitOffsetPagedList add getTotalCount cache #3370

spinachomes opened this issue Mar 25, 2024 · 1 comment · Fixed by #3373
Assignees
Milestone

Comments

@spinachomes
Copy link
Contributor

spinachomes commented Mar 25, 2024

I suggest LimitOffsetPagedList.java cache getTotalCount method result, so getList method may directly return empty list to avoid an unnecessary query when getTotalCount had done and It's result is equal to Zero.

@rbygrave
Copy link
Member

rbygrave commented Mar 25, 2024

Not sure about this in that it's designed to be able to run the 2 queries in parallel. So I don't think it's worth it. If you want to prepare a PR for what you were thinking about I'd have a look?

Edit: Ok, got it - TLDR when totalRowCount has already been determined and is 0 then we can skip finding the list and return an empty collection for this case.

spinachomes added a commit to spinachomes/ebean that referenced this issue Mar 26, 2024
@rbygrave rbygrave linked a pull request Mar 31, 2024 that will close this issue
rbygrave added a commit that referenced this issue Mar 31, 2024
* #3370 LimitOffsetPagedList add getTotalCount cache

* Move totalRowCount check to inside the lock

* No change, format only on LimitOffsetPagedList

---------

Co-authored-by: Rob Bygrave <robin.bygrave@gmail.com>
@rbygrave rbygrave added this to the 14.1.0 milestone Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants