Quantcast
Channel: Go4Expert
Viewing all articles
Browse latest Browse all 1987

How to build indexes for multiple Max() functions for SQL Server?

$
0
0
For some SQL statements with multiple Max() functions in the select list and nothing in the Where clause, we have different methods to create new indexes to improve the SQL speed.
Here is an example SQL, it is to retrieve the maximum name and age from the employee table.

select max(emp_name), max(emp_age)
from employee

The following is the query plan that takes 9.27 seconds.
[​IMG]
The SQL cannot be tuned by SQL syntax...

How to build indexes for multiple Max() functions for SQL Server?

Viewing all articles
Browse latest Browse all 1987

Trending Articles