Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
3.40/5 (2 votes)
See more:
Why using "Select EmployeeId,EmployeeName from empTable" is better performance than "Select * from empTable"?

Let assume that in empTable there is two field EmployeeId and EmployeeName
if we want to retrieve all the records then we may use the following command
Select * from empTable;
but the better performance ...if we use
Select EmployeeId,EmployeeName from empTable;command.

please tell me why?
Posted
Updated 2-Jul-13 20:18pm
v4

Refer to this link

Top Ten SQL Performance Tips[^][Refer to tip3 and tip4]

SQL Tuning or SQL Optimization[^]

:doh:[Edit]:

Efficient SELECT statements[^]

Regards.. :laugh:
 
Share this answer
 
v2
Comments
Tanumay99 3-Jul-13 2:21am    
I know this is use for SQL-Server optimization process. and I read related information regarding that.But i donot understand how it optimize...?
please share if you konw how it works...
Thanks7872 3-Jul-13 2:23am    
You have not refered to any of the link above.If you did,then you would get the answer.Explaination is there.
Tanumay99 4-Jul-13 1:08am    
thanks for your help
Thanks7872 4-Jul-13 1:09am    
You are welcome.Call again.
i think, in this scenario no change in performance

but in cases

table have 10 columns but you need 3 columns only, in that this improves performance

* - which will return all columns in the table -> degrades performance

specified - will returns specified columns only -> improves performance
 
Share this answer
 
Comments
Tanumay99 3-Jul-13 2:40am    
my questen is...
if there is 10 columns and if we use "select *" command to retrieve all the fields and if we use
"select field1,.....field10" to retrieve all the fields....then second one is better to performance .
my questn is why??
please try to understand my questn...

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