FILTER slow

Andreas Albarello andreas.albarello at TERRITORIUMONLINE.COM
Thu Sep 13 06:22:22 EDT 2007


Stephan Holl wrote:
> I have a problem using the FILTER inside a shape-layer. It turns out
> that the filters are getting quite slow when using more than ~500
> or-validations.
> 
> The filter gets applied by mapscript based on an
> external-database query-result. Are there some tuning-tipps how to
> 'filter' (shape)-datasets with large results efficient?
> 
> Currently the filter looks like this
>  LAYER
>     DATA "adr"
>       FILTER ( [adr_id] = 6446 OR [adr_id] = 6366 OR [adr_id] = 6483 OR
> [adr_id] = 6534 OR [adr_id] = 6535 OR [adr_id] = 6481 OR [adr_id] =
> 6489 OR [adr_id] = 6490 OR [adr_id] = 6478 OR [adr_id] = 6587 OR
> [adr_id] = 6484 OR [adr_id]
> [many more follow]

Stephan,

I've never done any benchmarking of this stuff myself, so I really don't 
know if this is going to be of any advantage, but you might try to use 
this syntax which should yield to the exact same results but is much 
more concise and should therefore at least take less parsing effort by 
Mapserver:

FILTER ([adr_id] IN '6446,6366,6483,...')

This is actually some sort of undocumented query syntax, so don't tell 
anybody ;)

I'd appreciate it if you'd report back whether this actually was of any 
help or not.

Best regards,
-- 
--------------------------------------------------------------------
Andreas Albarello
Analysis & SW Development

Territorium Online srl/GmbH
Via Buozzi/Buozzistraße 12 - I 39100 Bolzano/Bozen
email: andreas.albarello at territoriumonline.com
web:   www.territoriumonline.com
--------------------------------------------------------------------



More information about the mapserver-users mailing list