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

ENH Do not use placeholders for int ID filters #10861

Merged

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz commented Jul 6, 2023

Issue #10860

Quering time on SC hosting doing a ->filter['ID' => $ids] with 10,000 records - pretty consistent with initial laptop testing in parent issue where it's roughly 3x faster with placeholders turned off

Placeholders on - avg 0.1175s

0.1378s
0.0884s
0.1123s
0.1408s
0.1080s

Placesholders off - avg 0.0348s

0.0498s
0.0232s
0.0259s
0.0550s
0.0202s

@emteknetnz emteknetnz force-pushed the pulls/5/no-placeholders branch 3 times, most recently from f5b0b09 to 5c213f6 Compare July 6, 2023 04:22
@emteknetnz emteknetnz force-pushed the pulls/5/no-placeholders branch 2 times, most recently from 6297fb3 to eaeba64 Compare July 24, 2023 03:58
@emteknetnz emteknetnz marked this pull request as ready for review July 24, 2023 04:15
@emteknetnz emteknetnz force-pushed the pulls/5/no-placeholders branch 2 times, most recently from 3a427a5 to 676d2d4 Compare July 24, 2023 04:31
tests/php/ORM/ExactMatchFilterTest.php Outdated Show resolved Hide resolved
src/ORM/Filters/ExactMatchFilter.php Outdated Show resolved Hide resolved
src/ORM/Filters/ExactMatchFilter.php Outdated Show resolved Hide resolved
src/ORM/Filters/ExactMatchFilter.php Outdated Show resolved Hide resolved
src/ORM/Filters/ExactMatchFilter.php Outdated Show resolved Hide resolved
tests/php/ORM/ExactMatchFilterTest/Project.php Outdated Show resolved Hide resolved
tests/php/ORM/ExactMatchFilterTest.php Outdated Show resolved Hide resolved
tests/php/ORM/ExactMatchFilterTest.php Outdated Show resolved Hide resolved
tests/php/ORM/ExactMatchFilterTest.php Outdated Show resolved Hide resolved
tests/php/ORM/ExactMatchFilterTest.php Outdated Show resolved Hide resolved
@emteknetnz emteknetnz force-pushed the pulls/5/no-placeholders branch 2 times, most recently from 2a17c51 to c17ba22 Compare July 24, 2023 22:47
private function usePlaceholders(string $column, array $values): bool
{
if ($this->config()->get('use_placeholders_for_integer_ids')
|| !preg_match('#^"(.+)"."(.+)"$#', $column, $matches)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's obviously doing more than just getting that value, since we're explicitly saying to use placeholders if the regex doesn't match. What scenarios will there be a column that doesn't match that pattern that we're 'protecting' against?
does this PR handle filtering against "MyRelation.ID"?

@emteknetnz
Copy link
Member Author

@GuySartorelli I added more explanation

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well locally.
Just one more test scenario to add please.

I've also created a separate but related issue: #10887

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, merge on green

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.

2 participants