I am writing a procedure and find myself using the same
select statement with the same
where clause a lot. Currently the table holds over 55000 rows and grows about 100 or so rows each day. The two
where clauses cut the data down to a few hundred rows in total.
I run the exact same select statement over a dozen times and the data results will always be the same, within the same run. Would it be better, performance-wise, to keep running the same select statement or should I do an
insert into select to fill a temp table with only the data I need and pull from there instead?
Select statement ran (with some some IDs redacted):
SELECT WorkDay1, WorkDay1Brea, StartBreak, StrtTm FROM dbo.DriverTimes WHERE DriverTime.DrvrID = @DriverID AND CONVERT(VARCHAR(12), dtwrkd, 112) = CONVERT(VARCHAR(12), @StartDate, 112) AND PryllID IN ( ListOfIDs );
This select is ran a total of 8 times for each Driver and there are 40 some odd drivers.