-
Notifications
You must be signed in to change notification settings - Fork 141
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
Problem to paginate query with aggregates in sub queries #106
Labels
Comments
Have you found any solution or did you try |
Same here. It seems The Doctrine Paginator issues the method getCountQuery, even if the "knp_pager.count" hint is set. That results for me in an error (Single id is not allowed on composite primary key" can you check the value of |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have to paginate a Doctrine query with sub queries doing aggregates. I have to paginate over 1000 rows.
My orignal query looks like :
I have 5 aggregates like this.
1 is very slow because it run the query and aggregates on all 1000 rows. I solved it by using the knp_paginator.count hint to do my own count query.
2 souldn't be slow because it select only id from the original query. Nevertheless, it's not the case. All the fields of the selected entities are removed from the original query but the aliased field and subquery are kept. So paginator run a query like :
Instead of :
It as for consequence to run aggregates sub query on all the 1000 rows which is very slow.
The problem seems to be in the Knp\Component\Pager\Event\Subscriber\Paginate\Doctrine\ORM\QuerySubscriber where custom tree walkers are added.
Why my subquery aren't removed from the original query ? Is it a way to inject a custom query result as the knp_paginator.count hint ?
The text was updated successfully, but these errors were encountered: