[QGIS-Developer] Speeding up a virtual layer

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Thu May 6 01:33:45 PDT 2021


Hi list -

I have created a virtual layer using Python and shown this in my QGIS 
mapping window like this:

layer = QgsVectorlayer(?layer=/...layer "ref" definition... /&layer=/... 
"cur" definition.../&query=select ref.* from ref left join cur on 
ref."objekt-id" = cur."objekt-id" where cur."objekt-id" is NULL,"My 
layer", "virtual")|
|

i.e a left join between a Postgres layer "cur" and a GeoPackage layer 
"ref". And it works !!! (Thank you Hugo and whoever that has developed 
this facility).

However, it is somewhat slow to react, when you ex. are using the "info" 
tool on the layer. AFAIK, it's not using the indexes in the original 
layers.

Is there any method (Python or otherwise) to speed up the response of 
the virtual layer ? For example by adding a temporary spatial index to 
the resulting virtual layer ?? Some "magical keywords" in the creation 
parameters for the layer ???

-- 

Med venlig hilsen / Kind regards

Bo Victor Thomsen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210506/51fedbc3/attachment.html>


More information about the QGIS-Developer mailing list