Must select * always be avoided? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Must select * always be avoided?

I know it’s considered tabboo to use select * in a production query but I wanted to get opinions on whether the idea I have would be a good place to use it. I’m a .NET developer and naturally I build my applications in tiers. One of the tiers holds business entities and then the next is the data access. In the actual DB, I’ll take one entity for example, I’ve got the table and then a view based on that table. Then I have several stored procedures that do select * from view each with its own criteria. The reason I thought this would be good is that if I wanted to add a field to the table I could add the field, modify the view and then modify the constructor of the entity. The new field would automatically be selected in all the procedures that select on that view. Does this some like a reasonable situation to use that practice? Rob Mills
Always use column names instead of *.
1. Select only required columns to improve performance…
2. If you add additional columns to a table …. increase the chances of breaking applications…
Read…Transact-SQL Query SQL Server Performance Tuning Tips
http://www.sql-server-performance.com/transact_sql.asp
In your queries, don’t return column data you don’t need. For example, you should not use SELECT * to return all the columns from a table if you don’t need all the data from each column. In addition, using SELECT * prevents the use of covered indexes, further potentially hurting query performance. Mohammed U.
Other than that
If you use exists, it is better if you use * If exists(Select * from table…….)
—stuff
Madhivanan Failing to plan is Planning to fail
quote:Originally posted by Madhivanan Other than that
If you use exists, it is better if you use * If exists(Select * from table…….)
—stuff
Disagree. Its better to use a constant instead of * Roji. P. Thomas
http://toponewithties.blogspot.com

&gt;&gt;Disagree. Its better to use a constant instead of *<br /><br />[<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br />It is always a debatable one<br /><br />Madhivanan<br /><br />Failing to plan is Planning to fail
Not really. But we’ve discussed this here before. Search for "star expansion". [<img src=’/community/emoticons/emotion-5.gif’ alt=’;)‘ />]<br />–<br />Frank Kalis<br />Moderator<br />Microsoft SQL Server MVP<br />Webmaster:<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a>
]]>