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

Richard Duivenvoorde rdmailings at duif.net
Mon May 9 07:06:43 PDT 2022


Ok FYI my main issue was I got the layer connected to a 
'selectionChanged' signal...

THAT was wat making my selections so slow.

Got to it because a duplicate layer, or the loading the saved gpkg again 
the same selection was super fast...

Sorry for the noise

Regards,

Richard Duivenvoorde

On 2022-05-09 11:54, Richard Duivenvoorde via QGIS-Developer wrote:
> 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
> 
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list