Bug report #11348

Add PostGIS layers is too slow on connecting to a database

Added by Harry Clarke over 9 years ago. Updated over 5 years ago.

Assignee:Harry Clarke
Category:Data Provider/PostGIS
Affected QGIS version:2.4.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:19639


Add PostGIS layers is too slow. The reason is that when connecting to the database, every table and view is read along with all the details. This is not necessary. Instead QGIS should first identify the Schemas that are present within the database, as this is the first screen displayed to the user. Tables and Views should only be read if the Schema is selected, but only the name of the table or view. When the table or view is selected, then the additional information should be read.

This is being reported as a bug rather than a feature request, as it is a usability issue.


#1 Updated by Mathieu Bossaert over 9 years ago

Good morning Harry,

did you try to check the "do not resolve geometry type..." option in the database connection settings ?

It inscrease a lot the listing of all views and tables.


#2 Updated by Harry Clarke over 9 years ago

Morning Mathieu,
I am not sure exactly which option you are referring to.
I did try ticking the option "Don't resolve type of unrestricted columns (GEOMOTERY)", which is a lot quicker, but that only shows half of the schemas, and not the schema I am interested in, so not very helpful.


#3 Updated by Harrissou Santanna over 9 years ago

Harry, It doesn't solve the issue you are reporting (and this really needs to be fixed) but you should try DB Manager (which is a core plugin of QGIS).

#4 Updated by Harry Clarke over 9 years ago

Hi Harrissou,

Unfortunately DB Manager is unable to add the layer I am interested in, see issue #11317. Because the aggregated view doesn't have a primary key set. Hence it is only possible in the Add PstGIS layers command, where the primary key can be set to some column that happens to be unique.

#5 Updated by Jürgen Fischer over 9 years ago

  • Category set to Data Provider/PostGIS

#6 Updated by Giovanni Manghi almost 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#7 Updated by Harry Clarke over 5 years ago

  • Status changed from Open to Closed
  • Assignee set to Harry Clarke

Checked and the issue now seems to be resolved in QGIS v3

#8 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to fixed/implemented
  • Description updated (diff)

Also available in: Atom PDF