[mapserver-users] Efficiency - Postgres/gis view or Mapserver data definition join

Dara Olson dolson at glifwc.org
Thu Apr 28 14:34:02 EDT 2011

Greetings.  I am hoping that I have posted this on the most appropriate list, please let me know if I should be posting to a different list. 

In our Mapserver application, we join a lot of tables together - generally one table with geometry to a "flat" table with tabular data.  My question is - is it more efficient/faster to create a view in PostgreSQL doing the join and link to the view table from Mapserver or to define the join (SQL statement) with Mapserver in the data definition within the layer definition? Does it even matter because Mapserver sends the request to PostgreSQL/GIS? 

Also, we have joins that take a field within the flat table to determine which table to join to get geometry.  For example, if the flat table column "join" value is equal to 1 then it joins to "table1" to get geometry or if column "join" value is equal to 2 then it joins to "table2" to get geometry. I read something that you were not supposed to use WHERE clauses in the Mapserver data definition.  Would this be better to do as a view and link to the view table from the data definition?

Any advice would be greatly appreciated.  Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110428/0559dcd3/attachment-0001.html

More information about the mapserver-users mailing list