Why is "Select * " a bad choice?

 Posted by Niladri.Biswas on 5/16/2013 | Category: Sql Server Interview questions | Views: 3030 | Points: 40
Answer:

For as long as there has been T-SQL code, there has been prevalent use of SELECT
*. This is the most straightforward way to determine what a table looks like in ad hoc and troubleshooting scenarios.
In many cases, not all the columns in the table or view are required by the application.
Using SELECT * in this case can cause wasteful scans or lookups in order to
return all of the columns, when the query may have been satisfied by a covering index at a much lower resource cost. Not to mention there’s the additional overhead of sending all the unneeded columns over the network just to have the application ignore them in the first place—or worse, incorporate them into the code, never to be used.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response