[mapserver-dev] Improving WFS GetFeature Performance
Seth G
sethg at geographika.co.uk
Fri Feb 21 14:40:26 PST 2020
Hi all,
I've been trying to see where WFS database queries could be optimised, and there is one change that gave a huge performance boost in certain situations.
A WFS LAYER can be configured with "gml_include_items" "all" to allow maximum flexibility for the client. A WFS request allows a propertyName parameter to be passed via the query string to only return data for the requested fields e.g. &propertyName=ogr_fid,name will return features with only these 2 attributes. This greatly reduces the amount of data transferred to the client.
However the database query itself still selects data for all fields for the layer (confirmed in both the MSSQL and PostGIS drivers).
Selecting only the propertyName fields in the query can have a huge effect on the database query time, especially for layers which have 10s of fields, but where each request may only require 5-6 fields at any one time. In my test case 13,000 records with 50 fields takes 12 seconds compared to running instantly for 5 fields.
A related-case are vector tiles which also select all fields on every request [1], unlike their WMS equivalent which uses msLayerWhichItems to find the minimum required fields.
Perhaps this is another case that would benefit from selecting only the required fields?
Any thoughts on why any attempts to implement the above might be flawed or have unforeseen consequences?
Seth
[1] https://github.com/mapserver/mapserver/blob/de351bbcc17360807ccae52302c330d96486c0fc/mapmvt.c#L415
--
web:http://geographika.co.uk
twitter: @geographika
More information about the mapserver-dev
mailing list