Welcome Guest, Not a member yet? Register   Sign In
Help with homework question
#1

[eluser]Unknown[/eluser]
Hi,

Given the following query, how could it be optimized? list all assumptions

Code:
select c.* FROM companies AS c JOIN users AS u USING(companyid) JOIN jobs as J USING(userid) JOIN useraccounts AS ua USING (userid) WHERE j.jobid = 123;

Could anyone give me suggestions as to what can be done?

Thanks,

Jack
#2

[eluser]The Wizard[/eluser]
www.stackoverflow.com Smile they might help
#3

[eluser]garymardell[/eluser]
SELECT c.* is slower than listing all the fields that need to be selected for a start.
#4

[eluser]Rick Jolly[/eluser]
[quote author="garymardell" date="1266703960"]SELECT c.* is slower than listing all the fields that need to be selected for a start.[/quote]
If he really needs all the fields, then SELECT * is most likely faster.
#5

[eluser]Rick Jolly[/eluser]
<strike>As for the answer, ask yourself which 2 tables are relevant.</strike>
Never mind.

Edit: There are actually 3 relevant tables according to the query.




Theme © iAndrew 2016 - Forum software by © MyBB