<div dir="ltr"><br><br>On Wed, 12 Jun 2024 at 11:54, Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br><br>><br>> But... as you mention "bulk attribute changes", assuming you don't<br>> change geometries, you would be better using OGR_L_UpdateFeature() where<br>> you could specify to update only a subset of attributes instead of<br>> updating the whole feature. In that case, the RTree triggers would not<br>> run.<br><br>Thanks for the pointer Even -- indeed switching to OGR_L_UpdateFeature does give a massive performance boost and avoids the unwanted index updates! This is great!<br><br>> That said even if the update RTree trigger runs, it checks that the<br>> geometry hasn't changed, so as you mention rtreeUpdate running, I<br>> suspect you change the geometries as well, in which case I have no<br>> suggestion.<div><br></div><div>There was definitely no (intentional) geometry modification happening 🤷</div><div><br></div><div>Nyall<br><br>><br>> Even<br>><br>> Le 12/06/2024 à 03:30, Nyall Dawson via gdal-dev a écrit :<br>> > Hi list,<br>> ><br>> > I'm trying to understand some unexpected behavior I'm seeing while<br>> > profiling bulk attribute changes in a GPKG file.<br>> ><br>> > First, I start a transaction on the layer using<br>> > OGR_L_StartTransaction. This is successful.<br>> > I then make many calls to OGR_L_SetFeature, changing different<br>> > features, before finalizing the transaction with OGR_L_CommitTransaction.<br>> ><br>> > Now, when profiling this code, I'm seeing that<br>> > OGRGeoPackageTableLayer::ISetFeature(OGRFeature*) is taking a very<br>> > large chunk of time. This is due to the call to sqlite3_step at<br>> > <a href="https://github.com/OSGeo/gdal/blob/2b94d7a274bfeb881a176016de932ba8acd1b79a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp#L3134">https://github.com/OSGeo/gdal/blob/2b94d7a274bfeb881a176016de932ba8acd1b79a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp#L3134</a><br>> > triggering a call to rtreeUpdate within sqlite3.<br>> ><br>> > I'm confused as to why this is happening. If I'm in a transaction,<br>> > shouldn't the index update be deferred until the transaction is<br>> > committed? Why would it be updating after every individual update?<br>> ><br>> > Hoping someone can explain what I'm missing here...<br>> > Nyall<br>> ><br>> > _______________________________________________<br>> > gdal-dev mailing list<br>> > <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>> > <a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>><br>> --<br>> <a href="http://www.spatialys.com">http://www.spatialys.com</a><br>> My software is free, but my time generally not.<br>></div></div>