[Qgis-user] Adding layer slows down QGIS dramatically after adding a layer

Richard Duivenvoorde rdmailings at duif.net
Thu Aug 13 07:35:46 PDT 2020


On 8/13/20 3:57 PM, Peter Cornelissen wrote:
> Hi
> 
> I am using a Geopackage with about 15 tables (a mixture of lines, polygons and points), but each of these tables are
> used 40 or 50 times with filters as many of the elements are used on multiple layers.
> However, I am now finding that as soon as I add a new layer QGIS slows down
> and it is taking 60 seconds or more to do almost any action that involves
> redrawing (zoom in/out/ pan etc) or even moving a layer within the layers
> panel. If I save the project, close down QGIS and restart, it is fine again
> until the next time.
> 
> Any suggestions?
> 
> Thanks, Peter

Looking at the attributes which are used in the filters, add 'indexes' too the tables in the Geopackage? 

In QGIS you can do that by creating a connection to the gpkg with DataBase Manager and then:
 'edit table' > tab indexes, > add index

A geopackage is a sqlite database, so if you have some sql-client (DB-manager, DB-browser) you can fire the create index query there:
CREATE INDEX "foo_index" ON "mygeopackage" ("foo_column")

Note that these are plain indexes, no spatial ones.
IF your filters are spatial filters, then off course you need spatial indexes.

HTH

Regards,

Richard Duivenvoorde


More information about the Qgis-user mailing list