Well as you are probably realizing throwing raw server resources at a problem doesnât always mean you get better performance. There are a number of other issues at play that can be causing problems including additional software on the server hogging resources, missing indexes, network performance problems and more. Obviously troubleshooting performance issues can be a full time job in itself (aka Database Administrators).
Perhaps take a look at this blog for some ideasâŚ
But also take a look at the MySQL execution plan and perhaps compare it with the old server if you can. Maybe the difference in MySQL version means a different set of optimizations are being done and resulting in downgraded performance. Maybe your indexes are not correct or something similar.
This might take some time to diagnose, just attack the problem pragmatically and do good testing. Usually you will hit one thing that resolves the entire problem. Good luck!
I read those docx. Applied some changes, but still nothing
So this being the SELECT:
SELECT zip_code, city_name, region_name, country_code, country_name FROM geo.iplocal WHERE â1759464552â BETWEEN ip_from AND ip_to LIMIT 1;
and this Table has: 2675765 records
AND we have Index on: ip_from ip_to
It is currently taking 4 Seconds to get results back. Which is bad, since it is in a page where we have to have at least 30 such selects, which means 120 Sec for results to come back!
Do you have any concrete suggestions to improve this?
Can you please run EXPLAIN SELECT zip_code, city_name, region_name, country_code, country_name FROM geo.iplocal WHERE '1759464552' BETWEEN ip_from AND ip_to LIMIT 1; on the server and show us the result?
Considering the higher specs, and not mention the newer version of MySQL, I expect that all that there has not been much tuning done on the MySQL settings.
To get good performance of MySQL, it cannot be run with the âdefault installâ settings. This is even more important the more hardware you have available. In some cases, you also need to tune the Linux settings, like how many files it can keep open, memory usage etc.
It is usually best to get this done by someone that really knows what they are doing. Though if you start reading different tutorials online on Tuning MySQL, or books on the subject you should be able to get it running good by try and trial.
WOW WOW! After much trying this and that, I on a whim removed the Indexes on all columns
And then the Select would return results in 0.2 Sec which is like 100 times faster than we had the Indexes on. And of course as we well know on many cases Indexes are what makes results 100 times faster.
I guess Use-the-index-luke should changed to Use-the-index-luke-but-not-all-the-time
Sound like the planner decided to use a suboptimal index. Now that that index is gone it uses the correct index and that makes it fast again.
The comment from @TheRedDevil above still stands though. Using MySQL out of the box without any tuning will always be sup-optimal, and there will always be improvements possible by tuning.
You can be sure we are NOT âUsing MySQL out of the box without any tuningâ
We have been and are always seeking for ways to fine tune Mysql. Of course this thread was one jab for this purpose. And from this thread it is quite interesting, really astonishing, that we are told all along
âhow Indexed can make Mysql SELECTS fasterâ which is for sure True in most cases, as one can achieve 100 time faster results with Indexes. But on rare occasions, as in this case Index had actually made this SELECT operation run almost 100 times slower! So for sure Mysql fine tuning is a combination of science and art and testing and repeating.