[QGIS-Developer] Attribute indexes for (Temporal) Memory layers

Richard Duivenvoorde rdmailings at duif.net
Mon May 9 02:54:26 PDT 2022


Hi Devs,

I need to create a temporal selection of a temporal memory layer (just 
7500 points).

Creating the selection takes 15 seconds, using:
point_layer.selectByExpression(temporal_filter, 
Qgis.SelectBehavior.SetSelection)

DEselecting the features after my function takes 22 seconds, using
point_layer.selectByExpression(temporal_filter, 
Qgis.SelectBehavior.RemoveFromSelection)

To me that seems a pretty long time for 7500 features, but I think there 
is no way to tell the layer/provider to put some kind of index on the 
QDateTime attributes, is it?

An alternative is to save the temporal layer to a gpkg, and create an 
index myself...

Mmm, tested, even without an index on it, it is milliseconds to 
(de)select in a gpkg..

Just wondering if I'm doing something wrong with the memory layer

Idea's?

Regards,

Richard Duivenvoorde



More information about the QGIS-Developer mailing list