I have a QGIS project with several Geopackage-Layers. The project is quite slow in comparison to a project with shapefile or database layers. I started QGIS together with DebugView to find out what happens and recognised that every time I zoom in/out or select features QGIS makes a SQL select which queries every feature of the layers (Select * from...):
 ..\..\..\..\..\..\src\providers\ogr\qgsogrprovider.cpp(3504) : (QgsOgrProviderUtils::setSubsetString) [7000ms] SQL: SELECT *, fid as orig_ogc_fid FROM "lines" WHERE layer IN ('Verm. Randsteine und Belag') AND space=0 AND block=-1
I opened the file with SQLiteDatabaseBrowser to check if a spatial index exists and found a table "rtree_lines_geom" which seems to be used as a index:
CREATE VIRTUAL TABLE "rtree_lines_geom" USING rtree(id, minx, maxx, miny, maxy)
Is this a bug that QGIS always selects all features from the table instead of using an index?