In my project, a table has around 13 million rows and approximately 43 Gb of size. I tried to delete the first 1000 records using laravel delete method.But the execution takes more time and trow exception for me. The exception is
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction (SQL: delete from `demo_table` where `datetime` <= 2020-06-31 00:00:00 order by `id` asc limit 1000)
at r/laravel/framework/src/Illuminate/Database/Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|