Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jai2808
Starting Member
27 Posts |
Posted - 2008-12-04 : 07:36:37
|
Hi,I have a table with nearly 9 lac records and while retreving, its taking lot of time 17-20mins.I have Recordid as primary key and i pull the records between date range from front end using the following syntaxselect recordid from log where convert(varchar,dated,101) between@startdate and @enddate.do i need to put an index on the dated column.dated column contains date and time. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-04 : 07:44:24
|
Yes, you will need an index for "dated" column.And also you will need to stop using convert on the dated column.This will give you all records dated Dec 1, Dec 2 and Dec 3DECLARE @StartDate DATETIME, @EndDate DATETIMESELECT @StartDate = '2008-12-01', @EndDate = '2008-12-04'SELECT RecordIDFROM logWHERE dated >= @startdate and dated < @enddate E 12°55'05.63"N 56°04'39.26" |
|
|
|
|
|