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

QuerydslJpaPredicateExecutor.exists() solves the existence test non-optimally #2333

Closed
emmanuelidi opened this issue Oct 12, 2021 · 1 comment
Labels
type: enhancement A general enhancement

Comments

@emmanuelidi
Copy link

emmanuelidi commented Oct 12, 2021

The current implementation of QuerydslJpaPredicateExecutor.exists(Predicate predicate) appears to generate a SELECT count(..) FROM ... WHERE <predicate> query and then tests if this result is > 0 to determine if there are any results matching the predicate.

For larger datasets, this is a bit inefficient. It seems that one could do a SELECT * FROM ... WHERE <predicate> LIMIT 1 and test if any results are returned.

Does this sound reasonable? If so, I can create a PR to try and address.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 12, 2021
@mp911de mp911de changed the title QuerydslJpaPredicateExecutor.exists() solves the existence test non-optimally QuerydslJpaPredicateExecutor.exists() solves the existence test non-optimally Oct 13, 2021
@schauder schauder added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 18, 2021
@schauder
Copy link
Contributor

Sounds like a good improvement.
I'm looking forward to your PR.

quaff added a commit to quaff/spring-data-jpa that referenced this issue Dec 3, 2021
schauder pushed a commit that referenced this issue Dec 3, 2021
schauder pushed a commit that referenced this issue Dec 3, 2021
schauder pushed a commit that referenced this issue Dec 3, 2021
schauder pushed a commit that referenced this issue Dec 3, 2021
schauder pushed a commit that referenced this issue Dec 3, 2021
schauder added a commit that referenced this issue Dec 3, 2021
Adding author tag.

See #2333
Original pull request #2373
schauder added a commit that referenced this issue Dec 3, 2021
Adding author tag.

See #2333
Original pull request #2373
schauder added a commit that referenced this issue Dec 3, 2021
Adding author tag.

See #2333
Original pull request #2373
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants