SQL query takes longer time when date range is smaller?
问题 I have a simple select statement which selects data from a SQL Server 2000 (so old) table with about 10-20 million rows like this - @startDate = '2014-01-25' -- yyyy-mm-dd @endDate = '2014-02-20' SELECT Id, 6-7 other columns FROM Table1 as t1 LEFT OUTER JOIN Table2 as t2 ON t1.Code = t2.Code WHERE t1.Id = 'G59' -- yes, its a varchar AND (t1.Entry_Date >= @startDate AND t1.Entry_Date < @endDate) This gives me about 40 K rows in about 10 seconds. But, if I set @startDate = '2014-01-30', keeping