Skip to content

[5.1] Fix for the Pagination Query that selected all rows from a table and would fail on large datasets #9055

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

Closed
wants to merge 1 commit into from

Conversation

mxaddict
Copy link

@mxaddict mxaddict commented Jun 4, 2015

Implemented my 4.2.x Fix for the pagination count query into 5.1.x

Fix for the Pagination Query that selected all rows from a table and would fail on large datasets


$this->aggregate = null;
if ($grouped)
{
Copy link
Member

Choose a reason for hiding this comment

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

Please follow PSR2.

@GrahamCampbell GrahamCampbell changed the title Fix for the Pagination Query that selected all rows from a table and would fail on large datasets [5.1] Fix for the Pagination Query that selected all rows from a table and would fail on large datasets Jun 4, 2015
@mxaddict
Copy link
Author

mxaddict commented Jun 4, 2015

Updated the commit to have the changes you requested 😄

@@ -169,6 +169,20 @@ class Builder
protected $backups = [];

/**
* These are the fields that we backup when doing counts.
*
* @var string
Copy link
Member

Choose a reason for hiding this comment

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

not string, array

@mxaddict
Copy link
Author

mxaddict commented Jun 4, 2015

Added the changes

@GrahamCampbell
Copy link
Member

Ping @codelight89, @fcjailybo, @JoostK, @codelight89, and @jarektkaczyk for review. This function was last modified in #8310 which came out of #8113, #8112 and #7372 if we go all the way back. :)

@GrahamCampbell
Copy link
Member

@mxaddict could you use a better commit message please. Don't mention versions, just describe what it does. We then need to wait for some reviews. It's important we're sure this is good. :)

@mxaddict
Copy link
Author

mxaddict commented Jun 4, 2015

@GrahamCampbell updated the commit message 😄

@taylorotwell
Copy link
Member

Please send again when it has unit tests.

@mxaddict
Copy link
Author

mxaddict commented Jun 8, 2015

@taylorotwell, this was an existing feature and already has tests here:

tests/Database/DatabaseEloquentIntegrationTest.php in the testCountForPaginationWithGrouping Method

[Edit] I don't see why the original test needs changing, as it does the exact same thing that it used to, just FASTER, for larger Databases 😄

@mxaddict
Copy link
Author

mxaddict commented Jun 8, 2015

So what kind of test do I need to add? Cause the functionality is already tested in the original integration test. Let me know so that I can create one 😄

@GrahamCampbell GrahamCampbell reopened this Jun 8, 2015
@GrahamCampbell
Copy link
Member

Taylor, this already has unit tests. They were put it earlier when my PR was merged.

@GrahamCampbell
Copy link
Member

This is just a change in the implementation for performance reasons rather than a bug fix.

@mxaddict
Copy link
Author

mxaddict commented Jun 9, 2015

I Added more fields to the backupMoreFields array, cause they were not needing for the agregate and were causing slowness with union and join queries that used pagination.

@GrahamCampbell what do you think about the new list of backup fields?

@mxaddict
Copy link
Author

mxaddict commented Jun 9, 2015

@GrahamCampbell , I looked more into the current integration test, and I think the coverage is lacking, would it be OK for me to add a couple of tests to better cover the use-cases for the pagination count query?

Cause I might as well add it now while I'm fresh from making the changes.

function after selecting all rows from database
@mxaddict
Copy link
Author

mxaddict commented Jun 9, 2015

@GrahamCampbell, I implemented a couple of tests to make sure that the counts work as expected when using normal flow, count without grouping, count with grouping, count with grouping + joins, count with grouping + leftJoins, I tried to follow the way other tests were implemented, but let me know if I need to change/update anything.

Also, I'm not sure if the file I added the tests to is correct location, so let me know if I need to move them elsewhere.

@beanmoss
Copy link

👍

@zot24
Copy link

zot24 commented Jun 26, 2015

👍

1 similar comment
@overtrue
Copy link
Contributor

👍

@GrahamCampbell
Copy link
Member

Have you guys actually tested this out?

@mxaddict
Copy link
Author

@GrahamCampbell, I would advise we not merge this just now, I'm not sure that it's 100% A OK, can we ask for more input from other contributors?

@GrahamCampbell
Copy link
Member

Ping @codelight89, @fcjailybo, @JoostK, @codelight89, and @jarektkaczyk for review.

@taylorotwell
Copy link
Member

Let's re-open this when we are more confident then.

@giacomoburattini
Copy link

We had the same issue and we fixed it in a similar way, this is a big deal with large datasets. Watching this thread since we are interested in knowing when this pull request will be merged.

@mxaddict
Copy link
Author

mxaddict commented Aug 2, 2016

I don't think this will be merged anytime soon, We know the issue and know the solution, but I myself am not familiar with the process of making and getting a PR merged into this project, So i have left it for now, been busy with other stuff, sorry @giacomoburattini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants