Skip to content

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

Closed
@emmanuelidi

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.

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