[gdal-dev] Changing many features in a GPKG in a transaction, why is the index updated?

Nyall Dawson nyall.dawson at gmail.com
Tue Jun 11 18:30:37 PDT 2024


Hi list,

I'm trying to understand some unexpected behavior I'm seeing while
profiling bulk attribute changes in a GPKG file.

First, I start a transaction on the layer using OGR_L_StartTransaction.
This is successful.
I then make many calls to OGR_L_SetFeature, changing different features,
before finalizing the transaction with OGR_L_CommitTransaction.

Now, when profiling this code, I'm seeing that
OGRGeoPackageTableLayer::ISetFeature(OGRFeature*) is taking a very large
chunk of time. This is due to the call to sqlite3_step at
https://github.com/OSGeo/gdal/blob/2b94d7a274bfeb881a176016de932ba8acd1b79a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp#L3134
triggering a call to rtreeUpdate within sqlite3.

I'm confused as to why this is happening. If I'm in a transaction,
shouldn't the index update be deferred until the transaction is committed?
Why would it be updating after every individual update?

Hoping someone can explain what I'm missing here...
Nyall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240612/baf138cf/attachment.htm>


More information about the gdal-dev mailing list