[MAPSERVER-USERS] Connecting to PostGIS only one time for all the layers

rich.fromm nospam420 at yahoo.com
Mon Apr 21 19:31:07 EDT 2008



Emilio Ponce wrote:
> 
> I want to connect only one time to a PostGIS database, in order to
> improve the efficiency of my mapfile. Now I'm connecting in every
> layer with this lines:
> 
> "
> CONNECTIONTYPE postgis
> CONNECTION "host= ... "
> DATA "the_geom from comarcas
> "
> 
> Is there a way to do this only one time in all the mapfile using more
> than one layer?
> 

In each LAYER, add:

PROCESSING	"CLOSE_CONNECTION=DEFER"

This tells mapserver not to close the connection.  So you still need to
specify the connection multiply, but that's not that big of a deal, and you
will get the performance gain.  This is documented here:

http://mapserver.gis.umn.edu/docs/reference/mapfile/layer

But there are some caveats, and you might find yourself needing to apply a
local patch.  For more details, see:

http://www.nabble.com/CLOSE_CONNECTION%3DDEFER----Segmentation-fault-to15786741.html
http://trac.osgeo.org/mapserver/ticket/2497

- Rich

-- 
View this message in context: http://www.nabble.com/Connecting-to-PostGIS-only-one-time-for-all-the-layers-tp16816322p16817687.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the mapserver-users mailing list