Skip to content

Replaced the setting of Ids to the whereInQuery with a more performant implementation #476

wants to merge 3 commits into from

4 participants

HarmenM commented Oct 12, 2012

While working with large datasets in combination with pagination (ie. a pagination window of 100 or more), the performance drastically decreased.

I tracked the problem down to the setting of the parameters. In the old implementation, the parameters are set individually. This pull request sets the parameter as an array to the Query and Walker.

Testing results (# of entities, original performance, improved performance):
32 0,036 0,033
64 0,043 0,037
128 0,065 0,043
256 0,133 0,057
512 0,360 0,088
1024 1,212 0,157
2048 4,462 0,332
4096 17,203 0,818

HarmenM added some commits Oct 12, 2012
@HarmenM HarmenM Update lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php
replaced the for-loop which adds the InputParameters for a single InputParameter for use with an array instead of a set of scalars.
@HarmenM HarmenM Update lib/Doctrine/ORM/Tools/Pagination/Paginator.php
Replaced the foreach loop adding all IDs as single parameters with a single parameter which injects the IDs as an array.


thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

Doctrine member

Could you update the tests to match the newly generated SQL?

Doctrine member


HarmenM commented Nov 6, 2012

And hereby the updated tests.
My apologies for the delay.

Doctrine member

Merged into master and 2.3

@beberlei beberlei closed this Nov 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.