C
C
chelkaz2016-05-15 15:02:30
Laravel
chelkaz, 2016-05-15 15:02:30

How to iterate over a million records in a table?

The table has about a million entries. Foreychem I can sort out no more than 50 thousand. Memory is not enough. Increased to 7 gigs.
I did not find anything similar for the Laravel framework.
Asked a general topic Is there a limit for foreach?
But there advised PDO and fetch
Or memory to increase. I didn’t find anything like this in the Laravel docks, they advise through foraych.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nikita, 2016-05-15
@chelkaz

https://laravel.com/docs/4.2/eloquent
_ docks are stupid: ctrl+F -> Chunking Results

A
Anatoly Medvedev, 2016-05-15
@balamyt92

There is a table with records about one million. I need to sort it out and weed it out in the process of sorting.

give the input data and what you want to get as a result using several lines as an example.

T
terzi_eduard, 2016-05-17
@terzi_eduard

DB::table('users')->orderBy('id')->chunk(100, function($users) {
    // Process the records...

    return false;
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question