Why does nothing happen when I read larger amounts of data from the database? [closed]

  laravel, php

I have written an importscript in Laravel8. I use Laravel Command and the CLI to start the import. For smaller data sets (< ~20,000) it works quite well. But with more than ~25,000 records nothing happens. I don’t get any error message and the script doesn’t hang, no data was imported. I haven’t found anything in the Laravel logs either.

$gnews = DB::connection('mysql_wp')
  ->table('wp_posts')
  ->where("post_type", "post")
  ->limit(25000)
  ->get();
// 20.000  // works fine!
dd($news->count());

// AND
$news = DB::connection('mysql_wp')
  ->table('wp_posts')
  ->where("post_type", "post")
  ->get();
dd($news->count());
// output: `nothing`  // doesn't work

Why does it behave like this?

Source: Laravel

Leave a Reply