Hi,
I use “GetFeaturesInsideBoundingBox” on a MsSql2008Feature and this method takes 5 seconds.
The result returns more than 160000 items. It’ so long so I try to reduce the execution time.
I launch sql profiler to see what query is executed with the method GetFeaturesInsideBoundingBox
The query (Query1) is :
exec sp_executesql N’SELECT [Geom].STAsBinary() as [Geom],[CartoId] FROM [Carto].[CartoD ] with(index(Carto_01)) WHERE (geometry::STGeomFromWKB(@Geometry,2154).STIntersects(Geom)=1) AND ( TYPE = 4);’,N’@Geometry varbinary(93)’,@Geometry=0x01030000000100000005000000000000005C47154100000040A5265941000000005C4715410000000027995841000000007C621C410000000027995841000000007C621C4100000040A5265941000000005C47154100000040A5265941
go
In fact , I just need to know if the number of returned items is greater than 0, si I tested this query (Query2) :
exec sp_executesql N’SELECT [CartoId] FROM [Carto].[CartoD ] with(index(Carto_01)) WHERE (geometry::STGeomFromWKB(@Geometry,2154).STIntersects(Geom)=1) AND ( TYPE = 4);’,N’@Geometry varbinary(93)’,@Geometry=0x01030000000100000005000000000000005C47154100000040A5265941000000005C4715410000000027995841000000007C621C410000000027995841000000007C621C4100000040A5265941000000005C47154100000040A5265941
go
And the Query2 takes 1 second, which is better.
Question 1 :
Is it possible to overload querytools and to add a method like QueryTools.GetFeaturesIdInsideBoundingBox(f.GetBoundingBox(), ReturningColumnsType.NoColumns);
And this method would perform Query2 ?
Question 2 :
5 seconds to return 160,000 items with QueryTools.GetFeaturesInsideBoundingBox(f.GetBoundingBox(), ReturningColumnsType.NoColumns); It seems you normal ? If not, do you think the problem may be a bad spatial index ? Or other things ?
Thanks for your help.
Regards
Steph.