mapserver postgis connection
Paul Ramsey
pramsey at REFRACTIONS.NET
Wed Nov 2 13:28:58 PST 2005
What happens is that mapserver constructs a SQL query which asks
(paraphrasing)
"Give me spatial data that is inside this bounding box and has this
attribute condition"
PostgreSQL takes that SQL and creates an optimal query plan for it.
Shape file cannot do that. In theory, PostgreSQL/PostGIS will be
faster, particularly if both your spatial data and attribute data
have indexes. An optimal query plan will use the attribute index if
it is more selective than the spatial index. The trouble is that
categories don't tend to be very selective, in general, so the
practical performance of this setup is not going to be super. If you
goal is *only* performance, you are better off simply extracting your
our data file into several files, one for each zoom level, each with
only the data you want drawn at that zoom level. That is the
solution that will *always* be fastest.
P
On Nov 2, 2005, at 4:20 AM, Frans Knibbe wrote:
> Now if the data are stored in shapefile format, at small scales all
> the points in the extent would be read, after which only a small
> part would be rendered, if I understand correctly. This could be
> inefficient and lead to poor performance. If the data were stored
> in PostGIS, MapServer could be so smart to make a query for just
> the points that need to be drawn. I don't know if this actually
> happens...
More information about the MapServer-users
mailing list