[Mapserver-dev] Query efficiency
steve.lime at dnr.state.mn.us
Wed Mar 3 15:50:52 EST 2004
Your basic understanding is right on.
There are several reasons querys are different than draws. The basic
that drawing was the easiest place to start when doing the work to
a variety of data sources. Fundamentally the selection work (really
bounding box queries) necessary for drawing is very simple easily
by all data sources. The same is not true for queries. Early versions
may not have even supported true polygon intersection tests. The other
complicating factor has been that query results are not used for
after a query is complete. When drawing you basically read a feature
render it. That's not possible with queries. Templates enter the
and sometimes one layers result set may supercede anothers. I look at
I do labeling. You need the big picture to decide how to proceed.
I see two ways to fix things:
1) Add a query API that mimics the current layer api. All datasources
choose to implement a specific version of each query function, other
could fall back
on the current method. We'd need an abstract queryinfo stucture similar
to the layerinfo structure.
2) Store the retrieved features apart from the database (Note that we
have made a decision like this already by using MapServer expressions.
one way around that.) and hit those for subsequent passes through the
set instead of the database.
>>> David Blasby <dblasby at refractions.net> 3/3/2004 1:42:45 PM >>>
I dont want to be too controversial, but I dont like the current query
behaviour. (This is from the PostGIS/database perspective; it looks
good for shapefiles)
For example, if we have a database of Points (say apartments, golf
courses, parks, and police stations).
You do a query for police stations. The database will get a query
something like this:
SELECT geom_point, id FROM mypoints WHERE type ='police station';
Lets say it gets 3 points back - id=56, id=98, id=127.
It then makes these type of requests from the database (they're
more complex, but...):
SELECT geom_point, id, type FROM mypoints WHERE id =56;
SELECT geom_point, id, type FROM mypoints WHERE id =98;
SELECT geom_point, id, type FROM mypoints WHERE id =127;
From the shapefile perspective, the first query reads through the DBF
file, and the latter set of queries are very fast grabs (based on row
id) from the .shp and .dbf files.
Perhaps someone could tell me why there's a difference between the
normal (i.e. for drawing) requests and query requests. It would make
many of the datastores much simplier and maintainable.
I'm still a little fuzzy on the entire query system, so I could be
on the above,
Mapserver-dev mailing list
Mapserver-dev at lists.gis.umn.edu
More information about the mapserver-dev