SQL Server 2008 R2 – How to Speed Up Execution Time of Select Query

performancequery-performanceselectsql-server-2008-r2

My question may sound childish, but I am really googling a lot regarding this issue. I have a table tblUsers where 20 columns are present (FirstName, LastName, EmailAddress….), which has around 91,000 data.

When I use Select Query

Select * from tblUsers

It takes around 2 min 27 seconds to complete execution.

Is It really any way to speed up the execution time

Any type of suggestions will be welcomed. Thanks in advance

Best Answer

Is It really any way to speed up the execution time

You are running Select * from tblUsers and expecting it to be fast? You are selecting all columns and all rows from a table, so it will take its own time to return the result set. If there is a clustered index, an index scan would be used, and if the table is a heap, a table scan would be used.

If you want to increase the speed, you either have to add a WHERE clause to make query sargable or limit the number of columns, although the latter will not affect the execution time so much.

Also, if your data file lies on a fast storage (SSDs, Flash Drives, as compared to SATA disks), the query is likely to become faster.

Moral: If you are running select * on a table, don't expect the query to be fast, it would take its own time to retrieve all rows. If you are on a production system, running select * would really be a performance killer, so avoid it.