[Qgis-user] Adding PostGIS Layer (Query Before Load)

Jürgen E. Fischer jef at norbit.de
Tue Aug 6 05:29:18 PDT 2019


Hi Peter,

On Tue, 06. Aug 2019 at 11:43:44 +0000, Peter Borissow wrote:
>  OK, after enabling  "Use estimated metadata" on the connection, the Data Source Manager comes up (doesn't hang). I am able to select a table and apply a filter. After a brief delay, QGIS starts to load data. However, is see an odd query consuming resources in the database:
> SELECT st_extent("coordinate") FROM "public"."device_location"

That should be:

SELECT st_estimatedextent("public", "device_location", "coordinate")

Ignoring the where clause is one of the tradeoffs that is used with "estimated
metadata" - also the feature count can be inaccurate (see tip on
https://docs.qgis.org/testing/en/docs/user_manual/managing_data_source/opening_data.html).

Unless that column doesn't have pg_stats (ie. SELECT count(*) FROM pg_stats
WHERE schemaname='public' AND tablename='device_location' AND
attname='coordinate' is not 1) in which case st_extent is used, but with the
where clause.


Jürgen

-- 
Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-31
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden              https://www.norbit.de

-- 
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Juergen Fischer, Nils Kutscher HR: Amtsgericht Aurich HRB 100827
Datenschutzerklaerung: https://www.norbit.de/83/



More information about the Qgis-user mailing list