Author bforst
Recipients bforst
Date 2017-12-05.00:40:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1512434453.0.0.213398074469.issue32215@psf.upfronthosting.co.za>
In-reply-to
Content
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.

"""
UPDATE tbl
SET col2 = NULL
WHERE col1 = ?
"""

"""
UPDATE
  tbl
SET col2 = NULL
WHERE col1 = ?
"""

We have verified this using Python installs from python.org 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.
History
Date User Action Args
2017-12-05 00:40:53bforstsetrecipients: + bforst
2017-12-05 00:40:53bforstsetmessageid: <1512434453.0.0.213398074469.issue32215@psf.upfronthosting.co.za>
2017-12-05 00:40:52bforstlinkissue32215 messages
2017-12-05 00:40:52bforstcreate