Bug report #16216

OGR data provider is extemely slow on changing attribute values

Added by Martin Landa almost 8 years ago. Updated almost 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Attribute table
Affected QGIS version:2.18.3 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:24126

Description

OGR data provider is extemely slow on changing attribute values. The reason is simple, the method QgsOgrProvider::changeAttributeValues() doesn't use transactions. The attached sample scripts (qgis.py) shows more than 60sec elapsed time when changing attribute value for 1000 features stored in SQLite database.

execfile(u'/tmp/tmpMS2K_V.py'.encode('UTF-8'))
Time elapsed: 56.5938699245

qgis.py Magnifier (588 Bytes) Martin Landa, 2017-02-21 11:54 AM

qgis.py Magnifier (515 Bytes) Martin Landa, 2017-02-21 11:57 AM

Associated revisions

Revision 16a421c7
Added by Martin Landa almost 8 years ago

OGR data provider: use transactions when changing attributes and geometries (if possible) (fixes #16216)

Revision 6715441e
Added by Martin Landa almost 8 years ago

OGR data provider: use transactions when changing attributes and geometries (if possible) (fixes #16216)

Cherry picked from 16a421c7a8292b4e697363e5c57634ff57025e3a

History

#1 Updated by Martin Landa almost 8 years ago

#2 Updated by Martin Landa almost 8 years ago

  • % Done changed from 0 to 50

See https://github.com/qgis/QGIS/pull/4172

The sample script reports about 1sec when changing 1000 features in SQLite database compared to 60sec without transactions.

#3 Updated by Martin Landa almost 8 years ago

New pull request against master: https://github.com/qgis/QGIS/pull/4175

#4 Updated by Martin Landa almost 8 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF