WFS performance issue

Frank Warmerdam fwarmerdam at GMAIL.COM
Tue Feb 1 13:11:08 EST 2005

> MapServer seems to consecutively make full table scans for each
> parameter. The only spatial restriction obviously being what has been
> set in the MAP file extent parameter - as this kind of request does not
> have a spatial component.
> Never tired of a workaround we temporarily do it with a standard
> MapServer request with DUMP=True and the request FILTER parameters as
> [variables-] in the MAP file. This is far from being OGC WFS but it
> works fine. For some reason this currently will only work with OGR, we
> are still debugging thick oraclespatial.


I'm not sure I understand all the issues here.  My understanding is that
the MapServer WFS server is evaluating all the filter conditions by doing
a pass through the complete dataset to produce a final list of matching
ids, is that correct?

Can anyone comment on whether the WFS filters are just turned into
regular MapServer filters (as might have been set with the FILTER
keyword on a layer)?  If so, how does the WFS know which filter format
to set as it differs by data provider (OGR, shapefile, OracleSpatial)?

In MapServer 4.5 (possibly retrofit to 4.4.1?) I implemented support
in the MapServer OGR link to pass FILTER requests through OGR
and to the underlying driver in some situations.  That means, in the
case of OGR's OCI driver that the attribute query would be evaluated
in one SELECT statement within Oracle which I think would resolve
your performance problems.

However, to enable this the FILTER needs to be prefixed by the
WHERE keyword. Otherwise the filter is treated as being in the
same syntax as the shapefile filters and is evaluated by MapServer
with potentially terrible performance.

To be honest, I am fuzzy on alot of how attribute queries are working
in MapServer, and especially how WFS queries are handled so
I may be out in left field.

However, if the WFS code turns the WFS filter into a normal MapServer
filter it may be easy to hack it so the filter can be passed through to
OGR's low level driver.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at
light and sound - activate the windows |
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the mapserver-dev mailing list