There may be situations when a single table holds millions of records and you want to migrate those records to another table after processing. As far as MySQL is concerned here in this context, PHP has some limitations in terms of memory allocation and script execution time to process those rows.
PHP takes data into its allocated memory on server and then process further, also it automatically lends some extra bytes if it thinks it would be sufficient for the script to run and exit successfully. All these actions are handled automatically until the records are less 1000 but once it crosses this limit server resources become deficient of memory.