Skip to content

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

Closed

Description

@emmanuelidi

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.

Activity

  1. changed the title [-]QuerydslJpaPredicateExecutor.exists() solves the existence test non-optimally[/-] [+]`QuerydslJpaPredicateExecutor.exists()` solves the existence test non-optimally[/+] on Oct 13, 2021
  2. schauder commented on Oct 18, 2021

    @schauder
    Contributor

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

  3. added a commit that references this issue on Dec 3, 2021
    480b40e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions