MySQL Forums
Forum List  »  Performance

Re: Looking for understanding of optimizing queries
Posted by: Jørgen Løland
Date: September 09, 2011 02:35AM

> But because the optimizer figures out that it'll have to go through most of the
> records anyway, it decides it is faster to go through all of them via the
> selectByManagementState index. That is why EXPLAIN's output for that table looks > like this:

Correct

> And because the optimizer has decided it is faster to go through the entire table
> (via an index, but true nonetheless), it also gets mentioned in the slow log.
> Is that correct?

Yes

> If so, then given the fact that the WHERE condition only filters out very few
> rows (which is as designed), it will be impossible to write the query in a way
> that doesn't show up in the slow query log. If that is true, then my original
> goal of eliminating all entries in the slow log is actually going to be
> impossible. I'm going to have to live with some entries in the slow query log
> that look at all records, because that is actually optimal in some cases and I
> should "manually" disregard these slow-log entries.
> Have I understood this correctly?

Yes you have, and that's a good feeling now that it's (almost) weekend :-)

Hope this helps,
Jørgen Løland
Software Engineer, MySQL, Oracle
jorgenloland.blogspot.com

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Looking for understanding of optimizing queries
887
September 09, 2011 02:35AM


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.