# Magento 1.9.3 Deadlock found when trying to get lock in pdo.php

I have created a script to import inventory from CSV file. The script is ran with a cronjob that runs every 3 hours. It worked fine until I have a csv file that contains 11000 lines, and I got the following error every time I try to import this csv.

How can I avoid this error?

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction' in /public/lib/Zend/Db/Statement/Pdo.php:228

Stack trace:
#0 /public/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /public/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /public/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#4 /public/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('UPDATE index_p...', Array)