<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>QGIS Server 2.8.9; PostgreSQL 9.3.13; PostGIS 2.1.8, PGAdmin
      1.22.1<br>
    </p>
    <p>Hi,<br>
    </p>
    <p>I have a project I use with QGIS Server which has about 40
      PostGIS layers and some of them are queries on a materialized
      view.</p>
    <p>A getCapabilities query timeout after 10 minutes. I looked at
      postgreSQL log and saw that QGIS make this query :<br>
    </p>
    <p>"SELECT st_extent("the_geom") FROM (<i>myquery</i>) AS
      "subQuery_0"<br>
    </p>
    which needs to run completely my slow query to get the extent.<br>
    <br>
    I've used "estimatedmetadata=true" so I think this is not the
    correct behaviour and statistics should be used.<br>
    <br>
    Now when I look statistics for my view in pgadmin, a message says
    that 'there is no statistics for the selected object'.<br>
    I ran an ANALYSE of my view but that changes nothing.<br>
    <br>
    So I have several questions :<br>
    - First, is there a way to tell QGIS Server to use the project
    extent for every layer to avoid st_extent on every queries and speed
    up getCapabilities?<br>
    - Are pgSQL statistics available on materialized view? If yes, are
    statistics used by QGIS on view?<br>
    <br>
    Thanks for your help!<br>
    <br>
    <div class="moz-signature">-- <br>
      Nicolas BOISTEAULT<br>
      Développeur Web<br>
      Observatoire Régional de l'Environnement<br>
      Téléport 4 Antarès - BP 50163 - 86962 Futuroscope Chasseneuil
      Cedex<br>
      Tél : 05 49 49 71 18<br>
      <span style="color:#3E703F"><b>Soyez Eco-responsable, n'imprimez
          que si nécessaire</b></span></div>
  </body>
</html>