> - before the run : using a table instead of a view for 'cities_area_by_name' > may be of interest in order to build a dedicated spatial index for city > boundaries ? If this table/view is built only one time for each base update > (daily) the time taken may be of interest,
That's true, views are evaluated each time. Depending on the query it could be painful to get performance out of the query. Maybe instead of the view, there might be interesting to write an SQL stored procedure with immutable attribute and returning a set of (rows) data retrieved by the view. Thus PostgreSQL will evalutate the function once and then use the cache for each row, each time it is called. > A way to ensure that spatial indexes are used is to add a "&&" part to the > query maybe like this (2nd line added) : I'm not a PostGIS expert so I could not help on that part. The only way to get information on index usage in a query is to use explain and watch carefully the result. regards, -- Jean-Christophe Arnu
