Skip to content
Advertisement

Fastest way to get the max date in SQL database (Azure)

I have a table that has Many rows up to 1000000. and 300 columns

Question : I would like to know the fastest way to get the max date of the column ‘LastModifiedDate in table.

In My table I have the columns : Id, LastModifiedDate and others columns…

Thanks in advance for your help

Advertisement

Answer

If the inserted records are the latest LastModifiedDate and this LastModifiedDate column will not change after being written into the table.
I think you can create a Clustered index on the LastModifiedDate column. In a Clustered table, a SQL Server clustered index is used to store the data rows sorted based on the clustered index key values. You can referance this documentation Designing effective SQL Server clustered indexes.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement