I am exploring Spatialite in QGIS (2.10.1), and it is very slow to save tabular edits (with 1200 records, several minutes once I click the pencil button, versus less than 1 second with the data as a shapefile!!!). Here's my workflow:

  1. Add Vector a shapefile into QGIS and then Save As a Spatialite database.
  2. Add Vector the Spatialite layer from above and Open Attribute Table.
  3. Toggle Edit the attribute table and add an integer field, calculating it.
  4. Toggle editing off and save.
  5. File saving takes 2-3 minutes while the hard drive is on continuously.

When I repeat the above workflow using the same data in shapefile format, the file saving takes less than 1 second.

What can I do to speed up Spatialite?

| improve this question | | | | |
  • One thing I would try first, is check page_size and cache_size are reasonably set. There's a nice write up at gaia-gis.it/gaia-sins/spatialite-cookbook/html/system.html – SaultDon Aug 15 '15 at 23:12
  • 1
    I would start by making similar update with spatialite-gui and comparing the speed. If it is fast with spatialite-gui the reason for slow update must be in how QGIS is making the update. QGIS may for example make many small transactions instead one big, or then it may run VACUUM after update. I am not sure how to log the real SQL that is used. Databases created with recent Spatialite library log SQL statements into sql_statements_log table and there you might get some information. – user30184 Aug 16 '15 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.