Hi The featureCount() method of QgsVectorLayer is returning the number of all the features in the layer without considering the sql subset. Is this on purpose? regards Stefan Mit freundlichem Gruss Stefan Ziegler Leiter amtliche Vermessung Amt für Geoinformation Rötistrasse 4 4501 Solothurn 032 627 75 96