[mapserver-users] Inefficient rendering of layer

Mr. Puneet Kishor punk.kish at gmail.com
Tue Mar 27 13:21:35 EDT 2012


On Mar 27, 2012, at 12:17 PM, juliap wrote:

> SELECT geom , VotingFor FROM dbo.[BF_PROV_ELECTORAL_DIVISION] AS
> elec WITH (INDEX(ogr_geom_sidx)) JOIN dbo.[Survey] ON GeoL.STWithin(geom) =
> 1 
>        WHERE PartyVotingFor = 
>         ( SELECT TOP 1 [VotingFor] FROM dbo.[BF_PROV_ELECTORAL_DIVISION] AS
> elec2 WITH (INDEX(ogr_geom_sidx)) JOIN dbo.[Survey] ON GeoL.STWithin(geom) =
> 1 
> 			WHERE VotingFor <= '4' AND elec.ID = elec2.ID
> 			GROUP BY VotingFor
> 			ORDER BY COUNT(VotingFor)DESC



You should analyze that query directly against the database, that is, not via a mapfile query, to figure out where it is taking time. Perhaps it is looping unnecessarily, perhaps it is not using the indexes where you expect them to... only EXPLAIN ANALYZE will tell for sure.

Once you have the query running quick, it will be quick in MapServer as well.



--
Puneet Kishor


More information about the mapserver-users mailing list