SELECT MAX([RequestDateTime]) FROM GameRequests WHERE[ShopNo] = @shopNo and RequestDateTime >= CONVERT(DATE, GETDATE())
Should I add indexes for shopNo and RequestDateTime? If so shopNo is varchar(max), changing the max to 200 (actual data is 999999) affects the data inside?
The first thing you should do is cluster the table on ( requestDateTime, Id ) [rather than on just id]. If you want, you can retain the current PK, just make it nonclustered.
That will help with the query above. If you add a lot of rows in a day, across all shops, you may still want to consider adding a nonclustered index on ( shopNo, requestdatetime ).
SELECT DATEDIFF(SECOND, [RequestDateTime], GETDATE()) As [SecondsSinceLastRequest] FROM [dbo].[GameRequests] WHERE [ShopNo] = @shopNo AND DATEDIFF(SECOND, [RequestDateTime], GETDATE() ) < @delay