MySQL Forums
Forum List  »  Optimizer & Parser

Re: optimize request with order by and limit
Posted by: yassine laouija
Date: July 29, 2013 04:40AM

So how can i rearrange the fields in the tables ? and how execute the joins before order by and limit, we can reorganize the request that you sended me ?

SELECT TrkTypeID, TrkID, st.Alias
( SELECT trk.TrkTypeID , trk.TrkID , jb.StartDate,
FROM tracking trk
INNER JOIN TrackingEnv trkenv ON trk.TrkID = trkenv.TrkID
INNER JOIN Job jb on jb.JobID=trk.JobID
WHERE trk.TrkTypeID IN ( 2,3,10)
AND trkenv.EnvID IN ( 1,1,20 )
Order BY jb.StartDate DESC
LIMIT 0 , 10 ) foo
JOIN statustype st on st.StatusTypeID = foo.StatusTypeID

Options: ReplyQuote

Written By
Re: optimize request with order by and limit
July 29, 2013 04:40AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.