Slow MySQL Inserts from Python -
I am trying to use some data in Python (pymysql connector) in the MySQL database and I actually get poor performance Receiving (approximately 10 rows per second) The table is INODB, and I am using a multi-value insert statement and it has ensured that the AutoCommit has been shut down. Any ideas why my inserts are still very slow?
I initially thought that the auto sign was not properly disabled, but I have added the code to test that it is disabled during each connection (= 0).
Here's my example code:
: params.append ([i, i, i, i, i, i]) for category (1,500) insertDB ( Parameter) def insert DB (params): query = "" "in the INCERT test (o_country_id, i_country_id, c_id, period_id, volume, date_created, date_updated) value (% s,% s,% s,% s,% s, NOW Duplicate key update on (), NOW ()), trade_volume =% S, date_updated = NOW (); "" db.insert_many (query, params) def insert_many (query, params = none): cur = _connection.cursor () Try: _connection.autocommit (False) cur.executemany (query, parameters) _ pymysql.Error, e: print except the connection code () ("MySQL error% d:% s"% (e.args [0], e. Args [1])) cur.close () What else can be the problem Is? To execute the above example, it takes about 110 seconds to have an eternity.
Not sure what's wrong, but instead let me try the mysqldb and / or mysql connector module See if I get the same display number.
Comments
Post a Comment