I'm currently exploring QGIS-server 3.2.3 and QWC2.

Currently, I'm experiencing some issues with my postgres based vector layers, so I seek hints or pointers to my questions:

  1. PostgreSQL Connection pooling: Accessing the server via one QWC2 session I got nearly 100 postgres session. How is connection pooling working within QGIS-server? How many open connections is QGIS-server using and is this configurable?
  2. Tracing the database, I see that SELECT count(*) FROM "mytable" is issued very often. This might be an alive-check query for pooled connections(?) As this is a costly query on my large tables: where does it come from and is it configurable?
  3. The inital GetCapabilities request takes very long, again because my tables contain millions of records and for every layer a SELECT ST_Extent("wkb_geometry") FROM "mytable" AS ogrpgextent is issued. I wonder, why st_extent is requested and not st_estimated_extent, as the table is analyzed and SELECT count(*) FROM pg_stats WHERE schemaname='public' AND tablename='mytable' AND attname='wkb_geometry'; returns 1. And where does "ogrpgextent" come from, as my layers are defined with providerKey 'postgres' and not 'ogr'? It seems to me, that the database is not accessed via qgspostgresprovider but ogr(?)
  4. How can I enable verbose logging? I set FcgidInitialEnv QGIS_DEBUG 1, FcgidInitialEnv QGIS_SERVER_LOG_FILE /tmp/qgis-000.log, FcgidInitialEnv QGIS_SERVER_LOG_LEVEL 0 but I don't see any log QgsDebugMsg-statements which I'd expect to see...
  5. The docs state that QGIS has to be compiled with Postgres support. What does it take to compile QGIS with Postgres support? How can I figure out, if docker image qgis/qgis:final-3.2.3 is compiled with Postgres support? Docker container build-deps contains postgres-client , but unlike other databases the cmake call in the dockerfile does not include a flag like WITH_POSTGRES which I'd expect (in analogy to e.g. WITH_QSPATIALITE)?

The layers in the .qgs file are defined like this:

<layer-tree-layer expanded="0" id="mytable_20180912153643064"
source="dbname='mypassword' host= port=5432 user='myuser'
sslmode=disable key='objectid' srid=31467 type=MultiLineString
table=&quot;public&quot;.&quot;mytable&quot; (wkb_geometry) sql="
checked="Qt::Checked" name="mytable" providerKey="postgres">...</layer-tree-layer>

closed as too broad by Kadir Şahbaz, PolyGeo Sep 29 '18 at 1:42

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Welcome to SO. You may wish to break your question up into bite-sized pieces. You may get better and faster results if people feel they can answer a specific item instead of going through a whole list. – user1269942 Sep 28 '18 at 23:02
  • Welcome to GIS SE. As a new user, please take the Tour which emphasizes the importance of asking "One question per Question". – Vince Sep 29 '18 at 1:57