Geodjango spatialite test database initialization very slow on some systems
|Reported by:||tomlottermann@…||Owned by:||cardoe|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
While testing some of my gis models, I noticed that the test database setup ran really slowly (about 16 minutes on my harddisk).
I dug a little bit deeper into the code and noticed that the execution of load_spatialite_sql() in contrib/gis/db/spatialite/creation.py went really slowly. To be more precise the line:
I found this issue here:
This basically says that the InitSpatialMetaData() command is really slow on some systems, because it executes in many transactions.
One could speed it up by using one of the following solutions:
- pass 1 to the function. This makes (at least recent versions of spatialite) it execute in a single transaction. I am not really sure for which versions of spatialite this works.
- manually control the transaction:
cur.execute("BEGIN ;") cur.execute("SELECT InitSpatialMetaData()") cur.execute("COMMIT ;")
For people who have the test database outside the memory this might be a huge problem.
Change History (6)
comment:1 Changed 18 months ago by timo
- Easy pickings unset
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
- Type changed from Bug to Cleanup/optimization
- Version changed from 1.7-rc-2 to master
comment:3 Changed 16 months ago by cardoe
- Owner changed from nobody to cardoe
- Status changed from new to assigned
comment:4 Changed 16 months ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from assigned to closed