Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello! I want to ask you, what SQL query will be execute faster, when i specify table fields that i wish to select or when i write only LEFT JOIN, without cpecify it?
Posted
Comments
Richard C Bishop 8-May-13 17:12pm    
You have not provided any queries to compare. How are we supposed to tell you which one is faster? Besides, there are far too many factors that go into play when a query is executed to give you any accurate answer.
Jardin1 8-May-13 17:18pm    
For example:

SELECT Drivers.name, Drivers.ID Drivers.year, Cars.year, Cars.type, Cars.Id_Driver
FROM Drivers AS D
LEFT JOIN Cars ON D.ID = C.Id_Driver
WHERE ...
_______
OR Query is:
SELECT *
FROM Drivers AS D
LEFT JOIN Cars ON D.ID = C.Id_Driver
WHERE ...
_______
Sudhakar Shinde 10-May-13 1:51am    
Both the queries will take similar time since there is difference of columns you are selecting. Please check whether above mentioned query works properly.

1 solution

Given that you have added an example I believe the first query should execute faster, all things being equal. You should place indexed fields left most.

You could also try using MySql's tools to evaluate speed of execution (I haven't used MySql for a long time so don't recall what tools are available for that purpose).
 
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