У меня есть этот запрос, который выполняется за 7 секунд и производит 12 094 записей на моем локальном экземпляре SQL Server 2008 R2 (не экспресс). Однако для экземпляра Sql Server Express требуется 38 секунд. Это может быть просто различие между локальной машиной Hyper-V 8 ГБ и удаленной машиной GoGrid с половиной памяти.
Мой вопрос: я делаю что-то явно неэффективное?
Запрос:
declare @FromTimestamp datetime = '2012-02-01'
declare @ToTimestamp datetime = '2012-02-22'
DECLARE @to datetime = DATEADD(dd, 1, @ToTimestamp)
SELECT
Data.value('(/LendingTreeAffiliateRequest/Request/@AppID)[1]', 'varchar(50)') AS AppID,
Data.value('(/LendingTreeAffiliateRequest/Request/@type)[1]', 'varchar(50)') AS [Type],
[Timestamp],
Data.value('(/LendingTreeAffiliateRequest/@affid)[1]', 'varchar(50)') AS CDNumber,
Data.value('(/LendingTreeAffiliateRequest/Request/SourceOfRequest/VisitorIPAddress)[1]', 'varchar(50)') AS IP,
Data.value('(/LendingTreeAffiliateRequest/Request/SourceOfRequest/LendingTreeAffiliateEsourceID)[1]', 'varchar(50)') AS ESourceID,
Data.value('(/LendingTreeAffiliateRequest/Request/Applicant/State)[1]', 'char(2)') AS [State],
Data.value('(/LendingTreeAffiliateRequest/Request/Applicant/DateOfBirth)[1]', 'varchar(20)') AS DateOfBirth,
Data.value('(/LendingTreeAffiliateRequest/Request/Applicant/EmailAddress)[1]', 'varchar(255)') AS Email,
Data.value('(/LendingTreeAffiliateRequest/Request/Applicant/IsVeteran)[1]', 'char(1)') AS IsVeteran,
Data.value('(/LendingTreeAffiliateRequest/Request/Applicant/CreditHistory/CreditSelfRating)[1]', 'varchar(50)') AS Credit
FROM
WebLogEntry wle
INNER JOIN EventType et on wle.EventTypeId=et.Id
INNER JOIN [EventData] ed on wle.EventDataId=ed.Id
WHERE
(et.Id=2)
AND (Data.exist('/LendingTreeAffiliateRequest/Request/@AppID')=1)
AND ([Timestamp] BETWEEN @FromTimestamp AND @to)