Click here to Skip to main content
15,891,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
1.Select * From Employee

2.Select EmployeeCode,EmployeeName,Address1,Address2,Address3,Image From Employee


From the above 2 queries Which Elapsed time is less. please explain with details.


Table Structure: Employee


Column Name-----Data Type
EmployeeCode-----varchar(15)
EmployeeName-----varchar(40)
Address1---------varchar(30)
Address2---------varchar(30)
Address3---------varchar(30)
Image------------Image
Posted
Updated 17-Dec-13 1:43am
v3

Hi Pravin,

You should have asked google for this.
No problem I did search for you you can find reason here[^] .

By the way Thanks for asking this question.

Hope this helps you a bit.

Regards,
RK
 
Share this answer
 
Comments
[no name] 17-Dec-13 8:08am    
Also very general answer. Anyway I put a hint in my answer to your solution.
♥…ЯҠ…♥ 17-Dec-13 8:13am    
Thanks Idle63...!!!
[no name] 17-Dec-13 8:43am    
That is ok. I also learn by the link you posted ;)
♥…ЯҠ…♥ 17-Dec-13 8:44am    
;-)
In addition to solution 1 by RK, i would like to provide another useful links:
SQL SERVER – Time Delay While Running T-SQL Query – WAITFOR Introduction[^]
Getting IO and time statistics for SQL Server queries[^]

There are several things to do to increase query performance (time of execution).
7 performance tips for faster SQL queries[^]
Query Performance[^]

Finall conclusion: a query with list of necessary columns is always faster than SELECT *!
 
Share this answer
 
v2
Comments
Tom Marvolo Riddle 18-Dec-13 2:32am    
Thanks for this link:7 performance tips for faster SQL queries[^]
my 5!
Maciej Los 18-Dec-13 2:33am    
You're very welcome and thank you ;)
[no name] 18-Dec-13 8:46am    
Finall conclusion: a query with list of necessary columns is always faster than SELECT *!

=> This statement is definitively wrong!
Maciej Los 18-Dec-13 8:48am    
Please elaborate...
Have a look at magic word: "necessary"
Maciej Los 18-Dec-13 8:51am    
Have you seen article: "7 performance tips"?
A general answer is not possible, because in case packages size for one record fits -by "accident"- then there will be no difference in query performance.

Anyway I suggest:
a.) Query only the fields you need. Means no SELECT *
b.) The chance that Image decrease the perfromance is "high"
c.) Always use a where. Imagine you have a table with millions of records....

Please note the link by ♥…ЯҠ…♥ in his answer
 
Share this answer
 
v3

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