Bug report #477
Loading a PostGIS View is very slow
|Assignee:||Gavin Macaulay -|
|Affected QGIS version:||Regression?:||No|
|Operating System:||RedHat||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||10536|
The loading of a PostGIS view is much slower than the loading of a table with the same structure.
The simple view
CREATE OR REPLACE VIEW geo_gemeinden_v AS
SELECT oid, ogc_fid, wkb_geometry, name, gem_bfs, gmde_name, gmde_nr, bzrk_nr, eg_nr, plz, ktn_nr, new_date, archive_date, archive FROM geo_gemeinden;
needs 24secs to load. The table geo_gemeinden with the same structure less than 1sec.
For testing purposes I attach the dump of geo_gemeinden
#2 Updated by Gavin Macaulay - over 13 years ago
Qgis has to do a lot more work when loading views. It has to work out which table/column each column in the view comes from, and then choose a column to use as a unique key. This entails working out that information for all views in the database. If you have a lot of views in the database, this may take some time.
Nothwithstanding all of that, 24 seconds is a lot longer than 1 second, and this area clearly needs some more work, but it's unlikely to happen before we release 0.8.