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

[Long time Bug] Involving Aggregates and groups on queries #1892

Closed
kapv89 opened this issue Jul 17, 2013 · 6 comments
Closed

[Long time Bug] Involving Aggregates and groups on queries #1892

kapv89 opened this issue Jul 17, 2013 · 6 comments

Comments

@kapv89
Copy link
Contributor

kapv89 commented Jul 17, 2013

I encountered this bug when i tried a groupBy and pagination on a query which had joins, eloquent fkin pulls allll the damn results of the query into memory, which for any non-trivially joint query, are a LOT, and brings the app to a crawl, and for more than smallish join, it puts the system to a halt.
What more, when you have joins on your queries, the paginator somehow even ignores the distinct clause and gives you a huge number of total results.

The solution is pretty simple, when a query has groups , just wrap it in a sub-query and apply the aggregate via the super-query. This is something i tackled in l3 and it worked perfectly. But it was ignored over there too. Here is the link to the PR laravel/laravel#1360

I don't have time right now, but would be sending a PR for the same today itself, but would be great if its noticed this time.

@taylorotwell
Copy link
Member

I'll do some testing on your proposal.

@kapv89
Copy link
Contributor Author

kapv89 commented Jul 20, 2013

thanks, https://github.com/kapv89/reposed/blob/master/src/k/Reposed/QueryBuilder.php here is the solution that I am using in my projects atm, really want this thing tackled in the core

@taylorotwell
Copy link
Member

What is support like for this on all database platforms supported by Laravel?

@kapv89
Copy link
Contributor Author

kapv89 commented Jul 29, 2013

I don't think there should be a problem because this stuff belongs to the implementation independent theoretical stuff behind sql, but i will test it out in a few hours on mysql(where it works) , sqlite (where it probably works), postgresql, if possible, sqlserver, oracledb etc

@taylorotwell
Copy link
Member

Have we confirmed that this works on all platforms yet?

@kapv89
Copy link
Contributor Author

kapv89 commented Aug 4, 2013

Not yet. Past week has been very busy for me, and so is gonna be the next one. I am closing this issue for now, and would just send in a PR when I test it on all platforms. Till then its there as a ref. if you wanna try it out yourself

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

No branches or pull requests

2 participants