Click here to Skip to main content
15,904,500 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I think performance wise 2nd is faster

Which 1 do you recommend and why?

SQL
SELECT * FROM CUSTOMER_BAK

SELECT * FROM dbo.CUSTOMER_BAK
Posted
Comments
[no name] 28-Oct-11 8:51am    
I recommend not using txt-speak
CPallini 28-Oct-11 9:03am    
I second that.
CPallini 28-Oct-11 9:05am    
"Which one do you recommend and why?" is, for the human decoder, performance-wise better.

Why do you think the performance would be different? You would first need to know what dbo means in this context. Have a look here: http://msdn.microsoft.com/en-us/library/aa905208%28v=sql.80%29.aspx[^]

If you care about good coding and also about performance you might take another look at "select *". You should explicitly select the fields you want, something like "select A, B, C from table ...". This way you're sure you get the fields the way you want them (because no assumptions can be made on the defined field order of your table). Also, you get better performance by specifying only the fields needed and therefor don't retrieve data from fields you do not need.

Good luck!
 
Share this answer
 
Comments
Uday P.Singh 28-Oct-11 9:08am    
my 5!
FastEvo8 28-Oct-11 9:25am    
I totally agree, "Select *" needs to be avoided.
Selecting only the data you need is your first performance improvement hint!
As mentioned here
Worst Practice - Not Qualifying Objects With The Owner
[^] when you qualify the object SQL will not have to go looking for the object, so performance wise it will be better to use the qualified name.

Using qualified object will also make 100% clear what your intention is.
 
Share this answer
 
Comments
Corporal Agarn 28-Oct-11 10:42am    
I second that. Here I want people to use the database also but that is for our situation. Speed should not be an issue.
Hi Amol,
It is something related to before execution (precompile) matters , and its not related to runtime issues. So both of them are executed with the same performance.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900