mapserver postgis connection

Frans Knibbe frans at GEODAN.NL
Mon Oct 31 02:42:32 PST 2005


Hello Frank,

Thank you for the comments. I will certainly use CLOSE_CONNECTION=DEFER 
if I use PostGIS. But regarding the difference in performance between 
PostGIS and shapefile, doesn't the indexing PostGIS/PostgreSQL can do 
count for anything? For large datasets, you need a spatial index. I 
understand that the native shapefile driver (which is the recommended 
way to access shapefiles according to the MapServer Reference Guide for 
Vector Data Access 
(http://www.maptools.org/dl/docs/mapserv/MsVectorDataGuide.pdf)) does 
not support ESRI's spatial index for shapefiles. OGR, on the other hand, 
can use a spatial index (see 
http://www.gdal.org/ogr/drv_shapefile.html). Better still, it also 
supports an attribute index. An attribute index could be used by 
MapServer if a layer has a classification based on attribute values. I 
really don't know how MapServer reads and sorts its data, but I can 
imagine an attribute index will be beneficial for layers with 
symbolization based on attribute values. Still, if I understand 
correctly, the attribute index that OGR uses can not be used if a 
classification based on value ranges is wanted.


So is it really true that shapefiles always outperform PostGIS data, 
even if we are talking about big datasets with classifications?

Regards,

Frans



Frank Warmerdam wrote:

>On 10/28/05, Frans Knibbe <frans at geodan.nl> wrote:
>  
>
>>An interesting thread.
>>Shouldn't the connection step go faster if you have FastCGI enabled in
>>the MapServer?
>>    
>>
>
>Frans,
>
>My understanding is that PostGIS connection times are very fast
>so FastCGI is unlikely to give much benefit.  However, if you have
>many PostGIS layers in the map, I would encourage at least using
>the CLOSE_CONNECTION=DEFER processing option to ensure
>the same connection is used for all the layers.  This does not require
>FastCGI.   FastCGI basically just allows preserving the connection
>from cgi request to cgi request.
>
>  
>
>>Also, I wonder if PostGIS would improve relative to shapefile if you
>>have many concurrent users requesting the same data...
>>    
>>
>
>I am dubious about that.  The operating system will already preserve
>the shapefile data in RAM from request to request.  I would think
>that PostGIS would pay off in speed in cases that shapefiles don't
>optimize well, for instance if you want to filter out most data based
>on an attribute column, that could be done very fast in Postgres.
>
>Other than that, as folks mention Postgres' big benefit is flexability
>of data integration and updatability.
>
>Best regards,
>--
>---------------------------------------+--------------------------------------
>I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
>light and sound - activate the windows | http://pobox.com/~warmerdam
>and watch the world go round - Rush    | Geospatial Programmer for Rent
>
>
>  
>



More information about the MapServer-users mailing list