[mapguide-internals] What MapGuide does during database schema discovery?

Gabriele Monfardini gabrimonfa at gmail.com
Wed Mar 19 03:54:40 PDT 2014

Hi all,

I had a PostgreSQL/Postgis database with some schemas and many tables.
I'm connecting to it using MapGuide 2.5.2, OGR provider and a recompiled
gdal/ogr library to support PostgreSQL.

All is working fine except for one thing.
The first time that a map that use this db is opened it takes tens of
seconds to appear.
After the first time, the same map is opened in 3-4 seconds as it should.

Investigating this issue the problem seems to be in schema discovery since
purging cached schema information from maestro triggers again the slow

Analyzing database log I've found that MapGuide seems to try to evaluate
the extent of each geometry table in the database (brutally querying SELECT
Extent(the_geom) on all of them).

And we happen to have a few very complicated views, defined from several
other views, which are used in a totally unrelated project and never
in MapGuide. Querying the extent of those views eats a lot of seconds.

Tuning the views is not really an option since evaluating the extent is
somewhat unexpected on them.

Thus my questions are the following:

   1. What stats is MapGuide collecting on all tables? Are there anything
   2. Are there any way to manually exclude problematic tables?
   In PostGIS <2 I can drop the rows related to those tables from
   geometry_columns, since MapGuide use geometry_columns, but in PostGIS 2+
   this is no more possible.
   I've seen also that another possible workaround is to set the SRID for
   problematic tables to undefined, but again this is not always possible.
   Also I've not understood why the SRID does make this difference...
   3. Why is extent needed? And if really needed why don't use
   ST_Estimated_Extent (or ST_EstimatedExtent in PostGIS 2.1+) to have a
   quicker response from the database?

Best regards,

Gabriele Monfardini

More information about the mapguide-internals mailing list