MySQL Forums
Forum List  »  Optimizer & Parser

Re: two column int index not used correctly
Posted by: Jørgen Løland
Date: June 17, 2011 01:00AM

Hi Alexander,

Yes, for queries that read low-valued and high-valued IPs you will get good performance by using these two indices. You'll probably still have performance problems with IPs in the middle of the range.

> Also, to my understanding, since the value to return (country) is also in the index, MySQL doesn't have to fetch the value from the table, but directly takes it from the index, yes? Not that it has much impact in this case, but I just want to understand the workings a bit more.

I suggest you take a look at these [1] pages in the documentation. It answers this and probably quite a few more questions you have :-)

[1] http://dev.mysql.com/doc/refman/5.5/en/execution-plan-information.html and
http://dev.mysql.com/doc/refman/5.5/en/explain-output.html (See "Using index")

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

Options: ReplyQuote




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.