I am a programmer, dealing with a big table which the following scheme:
UpdateTime, PK, datetime, notnull Name, PK, char(14), notnull TheData, float
There is a clustered index on
I was wondering what should be faster:
SELECT MAX(UpdateTime) FROM [MyTable]
SELECT MAX([UpdateTime]) AS value from ( SELECT [UpdateTime] FROM [MyTable] group by [UpdateTime] ) as t
The inserts to this table are in chunks of 50,000 rows with the same date.
So I thought grouping by might ease the
Instead of trying to find max of 150,000 rows, grouping by to 3 rows, and then calculation of
MAX would be faster ? Is my assumption correct or group by is also costly ?