Author bforst
Recipients bforst
Date 2017-12-05.00:40:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
We're moving some code from Python 2.7 to 3.6 and found a weird performance issue using SQLite in-memory and on-disk DBs with the built-in sqlite3 library. In Python 2.7, the two update statements below (excerpted from the attached file) run in the same amount of time. In Python 3.6 the update statement with the table name on a separate line runs 400x-600x slower with the example data provided in the file.

SET col2 = NULL
WHERE col1 = ?

SET col2 = NULL
WHERE col1 = ?

We have verified this using Python installs from on macOS Sierra and Windows 7 for Python 2.7 and 3.6.

We have tried formatting the SQL strings in different ways and it appears that the speed change only occurs when the table name is on a different line than the "UPDATE".

This also appears to be hitting some type of quadratic behaviour as with 10x less records, it only takes 10-15x as long. With the demo in the file we are seeing it take 1.6s on the fast string and ~1000s on the slow string.
Date User Action Args
2017-12-05 00:40:53bforstsetrecipients: + bforst
2017-12-05 00:40:53bforstsetmessageid: <>
2017-12-05 00:40:52bforstlinkissue32215 messages
2017-12-05 00:40:52bforstcreate