Opened 15 years ago
Closed 15 years ago
#1855 closed patch (fixed)
Postgis View Layers with OID as primary key are loading very slow
Reported by: | hdus | Owned by: | jef |
---|---|---|---|
Priority: | minor: annoyance | Milestone: | Version 1.3.0 |
Component: | Data Provider | Version: | Trunk |
Keywords: | Cc: | horst.duester@… | |
Must Fix for Release: | Yes | Platform: | All |
Platform Version: | Awaiting user input: | no |
Description
I want to load a postgis view layer defined in a way that the OID represents the primary key of the view query result. No real primary key is defined in the source tables. When I query this view from psql it gives me the query result very fast. When I load this layer into QGIS it needs a very long time, more than 1 minute, to load this layer.
Attachments (1)
Change History (9)
comment:1 by , 15 years ago
Owner: | changed from | to
---|
follow-up: 4 comment:3 by , 15 years ago
Owner: | changed from | to
---|
Replying to hdus:
I want to load a postgis view layer defined in a way that the OID represents the primary key of the view query result. No real primary key is defined in the source tables. When I query this view from psql it gives me the query result very fast. When I load this layer into QGIS it needs a very long time, more than 1 minute, to load this layer.
Does "loading" mean only "inserting" or "displaying"? Inserting the view to the project can be slow, while QGIS tries to figure out what the primary key column is. Once that's done displaying should be quick. Saving the project and reloading it should be also quick as QGIS saves the key column it found.
If you add the layer using python you can also specify the key column using key=column and QGIS will just verify that it's unique.
See also #1535
comment:4 by , 15 years ago
Replying to jef:
Replying to hdus:
I want to load a postgis view layer defined in a way that the OID represents the primary key of the view query result. No real primary key is defined in the source tables. When I query this view from psql it gives me the query result very fast. When I load this layer into QGIS it needs a very long time, more than 1 minute, to load this layer.
Does "loading" mean only "inserting" or "displaying"? Inserting the view to the project can be slow, while QGIS tries to figure out what the primary key column is. Once that's done displaying should be quick. Saving the project and reloading it should be also quick as QGIS saves the key column it found.
If you add the layer using python you can also specify the key column using key=column and QGIS will just verify that it's unique.
See also #1535
Loading means inserting. I took a look at the comments of #1535 and there gjm talked about an option to select the primary key column by the user when he is loading the postgis layer. Maybe it is possible to make some changes of the Postgis loader UI in this direction?
by , 15 years ago
Attachment: | 1855_selectpkey.diff added |
---|
patch to implement optional key selection for views
follow-up: 6 comment:5 by , 15 years ago
Type: | bug → patch |
---|
comment:6 by , 15 years ago
Replying to jef:
Thank you for the patch. Yes in this way it works fine for me!
comment:7 by , 15 years ago
Milestone: | Version 1.2.0 → Version 1.3.0 |
---|
Hi,
what version of qgis are you using? platform?