MySQL Forums :: Performance :: Slow Query, Optimization Advice Needed


Advanced Search

Re: Slow Query, Optimization Advice Needed
Posted by: Øystein Grøvlen ()
Date: April 28, 2016 01:12AM

Hi,

AFAICT, the join order is the best you can get. However, one problem with MySQL 5.5 is that it re-computes statistics on every server restart. Hence, the query plan might not be stable. If you upgrade to MySQL 5.6, you will get persistent statistics that might give more predictable query plans.

Not sure how much it will give you, but you can consider creating some multi-column indexes for the non-unique index look-ups (aka ref access) in order to make the index cover all necessary columns. That way, the query will only need to access the index and not the actual table. Candidates are:

tblTrailerLogs(nMovementOutID, nTrailerID)
tblMovements(nTrailerID, tsMovement, nLocationID)

Øystein Grøvlen,
Senior Principal Software Engineer,
MySQL Group, Oracle,
Trondheim, Norway

Options: ReplyQuote


Subject Views Written By Posted
Slow Query, Optimization Advice Needed 724 Michael Lawson 04/26/2016 09:30AM
Re: Slow Query, Optimization Advice Needed 353 Øystein Grøvlen 04/27/2016 01:02AM
Re: Slow Query, Optimization Advice Needed 411 Michael Lawson 04/27/2016 07:20PM
Re: Slow Query, Optimization Advice Needed 358 Peter Brawley 04/27/2016 11:28PM
Re: Slow Query, Optimization Advice Needed 338 Øystein Grøvlen 04/28/2016 01:25AM
Re: Slow Query, Optimization Advice Needed 342 Rick James 05/01/2016 11:47PM
Re: Slow Query, Optimization Advice Needed 351 Øystein Grøvlen 05/02/2016 01:28AM
Re: Slow Query, Optimization Advice Needed 347 Øystein Grøvlen 04/28/2016 01:12AM


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.