Hi,

Just launched the new QGIS 3.24, and tests the SQL debugger, I just found out 
that the “feature count” does a while loop on all features in the layer to 
count.

While it’s probably necessary for shapefiles or stuff like that, it appears 
suboptimal for databases access. I found this part in the code that looks like 
to be responsible for the feature counts, 
https://github.com/qgis/QGIS/blob/master/src/core/vector/qgsvectorlayerfeaturecounter.cpp#L76-L90

Do you think I could make a special case for database-based provider 
(geopackage, postgres/oracle/mysql/etc…) that launch a “SELECT count(*) FROM 
table” instead of looping on all features.

Thanks.
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to