<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Hi Steve,<br></div><div><br></div><div>I've added a WIP pull request based on your approach at <a href="https://github.com/mapserver/mapserver/pull/5997">https://github.com/mapserver/mapserver/pull/5997</a><br></div><div>I ran into a few issues, but it may be possible to resolve them. I'd appreciate your opinion on if it is worth progressing down this path. <br></div><div><br></div><div>For the MVT case, do you think MVT merits its own METADATA keywords? E.g. "mvt_include_items" similar to the "wms_include_items" which is used for WMS GetFeatureInfo queries. <br></div><div><br></div><div>Seth<br></div><div><br></div><div id="sig62266145"><div class="signature">--<br></div><div class="signature">web:http://geographika.co.uk<br></div><div class="signature">twitter: @geographika<br></div></div><div><br></div><div><br></div><div>On Sat, Feb 22, 2020, at 12:19 AM, Steve Lime wrote:<br></div><blockquote type="cite" id="qt"><div><div dir="auto">The MVT case definitely represents an opportunity. It should be looking at the items metadata however you can limit items in SQL statements as a work around. I don’t know that you can limit items via WMS (definitely not via mode=tile). It does respect the items metadata in generating the tile.<br></div></div><div dir="auto"><br></div><div dir="auto">The trick with WFS would be using manipulating the items metadata based on propertyName value while at the same time respecting the original setting. That way you wouldn’t have to change a bunch of code elsewhere.<br></div><div><div><br></div><div class="qt-gmail_quote"><div class="qt-gmail_attr" dir="ltr">On Fri, Feb 21, 2020 at 4:40 PM Seth G <<a href="mailto:sethg@geographika.co.uk">sethg@geographika.co.uk</a>> wrote:<br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div>Hi all,<br></div><div> <br></div><div> 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. <br></div><div> <br></div><div> 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. <br></div><div> However the database query itself still selects data for all fields for the layer (confirmed in both the MSSQL and PostGIS drivers). <br></div><div> <br></div><div> 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. <br></div><div> <br></div><div> 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. <br></div><div> Perhaps this is another case that would benefit from selecting only the required fields?<br></div><div> <br></div><div> Any thoughts on why any attempts to implement the above might be flawed or have unforeseen consequences?<br></div><div> <br></div><div> Seth<br></div><div> <br></div><div> [1] <a rel="noreferrer" href="https://github.com/mapserver/mapserver/blob/de351bbcc17360807ccae52302c330d96486c0fc/mapmvt.c#L415">https://github.com/mapserver/mapserver/blob/de351bbcc17360807ccae52302c330d96486c0fc/mapmvt.c#L415</a><br></div><div> <br></div><div> --<br></div><div> web:<a rel="noreferrer" href="http://geographika.co.uk">http://geographika.co.uk</a><br></div><div> twitter: @geographika<br></div><div> _______________________________________________<br></div><div> mapserver-dev mailing list<br></div><div> <a href="mailto:mapserver-dev@lists.osgeo.org">mapserver-dev@lists.osgeo.org</a><br></div><div> <a rel="noreferrer" href="https://lists.osgeo.org/mailman/listinfo/mapserver-dev">https://lists.osgeo.org/mailman/listinfo/mapserver-dev</a><br></div></blockquote></div></div></blockquote><div><br></div></body></html>