[Qgis-user] Virtual layers intolerably slow to calculate

Jonathan Schultz jonathan at schultz.la
Sat Jan 1 20:00:15 PST 2022


Hello all,

I've been trying to build an atlas using a virtual layer as the coverage 
layer. Because I need the map to be controlled by the atlas I need the 
virtual layer to include the relevant geometry, which I fetch from a 
geometry layer via a join. However once I do this the performance 
becomes completely intolerable, ie over a minute to calculate the 
virtual layer. I tried making sure the joins happened on indexed columns 
and anything else I could think of to speed it up but it didn't seem to 
help.

To give an idea of the size of my data, the two layers I need to join to 
build the virtual layer contain 5061 and 32 records, and the resulting 
virtual layer 5061 records.

By way of comparison I tried computing the same virtual layer using 
PostGIS, without bothering to create indexes on the join columns, and it 
took <300ms.

So I guess the work-around is to just use a temporary PostGIS table in 
place of the virtual table. But this is rather disappointing.

Can anyone suggest what might be happening here or any cleaner 
work-around for this problem?

Thanks,
Jonathan


More information about the Qgis-user mailing list