Search code examples
pythonmysqlpymysql

Python3 script (using PyMySQL) ultra slow


I'm using Python to read extra large files (.csv) and insert each one on MySQL using PyMySQL.

On Windows, when I run the (same) script on Anaconda Spider, the speed of execution is more than 3000 lines per second.

On production server (a better hardware) running Ubuntu 20.04, the speed downs to 100 lines per second.

I have an homolog server with a poor hardware. On this homolog server the speed is over than 2500 lines per second.

Is there something that I have not seen?

My server lspcu:

enter image description here


Solution

  • I read about PyMySQL and MySQL drivers on Ubuntu 20.X and proceeded with a downgrade on the server. Ubuntu 18.04. The speed of insertions was reached. About 4K lines/second on my Python scripts.