Trying to see how I can improve the performance of this Sql query <p>I've got a SQL query which is trying to find all the Neighbourhoods in some Counties.</p> <p>When I use SQL Sentry Plan Explorer to visualize the query (IMO, a bit better than the tools provided with MS SSMS) it highlights a really slow performing part :-</p> <p>Full Plan</p> <p><img src="https://i.stack.imgur.com/EFGOM.png" alt="enter image description here"></p> <p>Zoomed in ....</p> <p><img src="https://i.stack.imgur.com/gRrwJ.png" alt="enter image description here"></p> <p>Details</p> <p><img src="https://i.stack.imgur.com/4gvNz.png" alt="enter image description here"></p> <p>SQL script:</p> <pre><code> -- Update which Neighbourhoods are in these Counties. INSERT INTO @NeighbourhoodCounties (NeighbourhoodId, CountyId) SELECT SubQuery.NeighbourhoodId, SubQuery.CountyId FROM ( SELECT e.LocationId AS NeighbourhoodId, b.LocationId AS CountyId, c.OriginalBoundary.STArea() AS CountyArea, c.OriginalBoundary.STIntersection(d.OriginalBoundary).STArea() AS IntersectionArea FROM @CountyIds a INNER JOIN [dbo].[Counties] b ON a.Id = b.LocationId INNER JOIN [dbo].[GeographyBoundaries] c ON b.LocationId = c.LocationId INNER JOIN [dbo].[GeographyBoundaries] d ON c.OriginalBoundary.STIntersects(d.OriginalBoundary) = 1 INNER JOIN [dbo].[Neighbourhoods] e ON d.LocationId = e.LocationId ) SubQuery WHERE (SubQuery.IntersectionArea / SubQuery.CountyArea) * 100 &gt; 5 -- a Neighbourhood has to be 5% or more to be considered 'Inside' </code></pre> <p>Can anyone help interpret this query? What do all these numbers mean? How can I use these numbers to help diagnose and improve my query?</p> <p><a href="http://stackoverflow.com/questions/5798487/how-can-i-create-a-spatial-index-on-an-indexed-view">I tried to make an indexed view on the spatial table</a> but that failed miserably.</p> <p>Can anyone help?</p>