I 간단한 쿼리에서 많은 처리를 생성하는 것처럼이 쿼리에서 임의/간헐적 인 SQL 시간 초과를 가져옵니다. 이것은 올바른 행동입니까?SQL 시간 초과 지리 쿼리
이 같은 간단한 저장 프로 시저가 있습니다
CREATE PROCEDURE [dbo].[FindClosestXNearCoordinates]
@latitude decimal,
@longitude decimal
AS
BEGIN
SET NOCOUNT ON;
declare @emptyGUID uniqueidentifier
set @emptyGUID = cast(cast(0 as binary) as uniqueidentifier)
declare @radiusInMeters float
set @radiusInMeters = 3500 * 1609.344
declare @coordinatePoint as Geography
SET @coordinatePoint = geography::STGeomFromText('POINT(' + CAST(@longitude AS VARCHAR(20)) + ' ' + CAST(@latitude AS VARCHAR(20)) + ')', 4326)
declare @coordinateRadius as Geography
set @coordinateRadius = @coordinatePoint.STBuffer(@radiusInMeters);
select top 1 [b].[BaseId], [b].[Code], [b].[Name], [b].[Location], [b].[TerritoryId], [b].[Latitude], [b].[Longitude]
from XTable b
where (b.GeoLocation.STIntersects(@coordinateRadius) = 1)
order by b.GeoLocation.STDistance(@coordinatePoint) asc
END
내가 SQL 프로파일 러를 캡처하고 그 쿼리와 내가 SSMS에서이 프로그램을 실행할 때 때문에 정말 혼란 행, 188여 문을 보여줍니다 단지 하나의 실행을 보여 주지만 응용 프로그램에서 실행하면 188 개의 하위 문장이 생성됩니다. :
[link] http://i.imgur.com/4Bk9y.jpg 여기 프로필 덤프가 있습니다. – ExtremeCoder123