I would like to do spatial join in QGIS DB manager on geopackage database. The query should look like this
select * from Soil_C_cadaster a, (select * from Soil_C_cadaster where forest_c is null) b where st_touches(b.geom,a.geom)
It's a cross join on the same layer with 13000 not so complex features but I'm limiting it to some 200 features in table b. Query takes more than two minutes, so I'm suspecting it's not using spatial index by default as would PostGIS with spatial predicate.
Here is example of tested polygons:
In post like this, there's written about use but just with one layer and search bounding box, not with more layers. I can't imagine how to write it correctly.