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

[10.x] Optimize exists validation for empty array input #48684

Merged
merged 1 commit into from Oct 10, 2023

Conversation

mtawil
Copy link
Contributor

@mtawil mtawil commented Oct 10, 2023

This PR addresses a minor efficiency issue in the exists validation method.

Previously, an unnecessary SQL query was executed when validating an empty array:

select count(distinct id) as aggregate from users where 0 = 1

The added check for a zero $expected value now bypasses this query, saving resources while keeping the intended validation behavior.

@mtawil mtawil changed the title optimize exists validation for empty array input [10.x] Optimize exists validation for empty array input Oct 10, 2023
@taylorotwell taylorotwell merged commit 3b40b36 into laravel:10.x Oct 10, 2023
21 checks passed
timacdonald pushed a commit to timacdonald/framework that referenced this pull request Oct 24, 2023
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 this pull request may close these issues.

None yet

2 participants