MySQL Forums
Forum List  »  Performance

Re: Slow JOIN to convert IP to Country Code
Posted by: Rick James
Date: May 27, 2009 09:46AM

Replacing
KEY `dateline` (`dateline`),
with
KEY (dateline, ip_interval)
would lead to "Using index", which would speed that query up somewhat.

You cannot avoid the "filesort" since the ORDER BY is not part of an index. It is a common myth that filesort means terrible performance. You your case, the temp table is probably a MEMORY table and the "filesort" is actually a qsort call from C.

The 15 seconds comes from having to wade through a million(?) rows. Keeping a summary table of daily (hourly?) subtotals would probably speed up your query by another 10x, maybe more.

If the slowlog is turned on, look in it; you will see "Rows examined".

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.