Hi Peter,
One further thing you could try, if not already done, is to create Spatial 
Index’s.
You can do this within QGIS under the Layer Properties, by going to the Source 
tab and selecting, Create Spatial Index.

See: 
https://medium.com/@wherelytics/understanding-spatial-indexes-in-ogc-geopackage-files-9960fdf71f82

Hope this helps

Richard.






——
Richard McDonnell MSc GIS, FME Certified Professional
FRM Data Management

——
Oifig na nOibreacha Poiblí
Office of Public Works

Sráid Jonathan Swift, Baile Átha Troim, Co na Mí, C15 NX36
Jonathan Swift Street, Trim, Co Meath, C15 NX36
——
M +353 87 688 5964 T +353 1 647 6543
https://www.opw.ie

——
To send me files larger than 30MB, please use the link below 
https://filetransfer.opw.ie/filedrop/richard.mcdonn...@opw.ie

Email Disclaimer: https://www.opw.ie/en/disclaimer/
From: Qgis-user <qgis-user-boun...@lists.osgeo.org> On Behalf Of Peter 
Cornelissen
Sent: 14 August 2020 00:19
To: rdmaili...@duif.net
Cc: qgis-user@lists.osgeo.org
Subject: Re: [Qgis-user] Adding layer slows down QGIS dramatically after adding 
a layer

Hi Richard

Thanks for the suggestion. They are plain filters and I tried indexing every 
table, but unfortunately it has made no noticeable difference.

Regards, Peter

On Thu, 13 Aug 2020 at 15:35, Richard Duivenvoorde 
<rdmaili...@duif.net<mailto:rdmaili...@duif.net>> wrote:
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
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to