I'm trying to optimise the Digital Ocean droplet that my Laravel web app is running on, and have noticed that MySQL is constantly using ~50% of its 1GB RAM. By far the most common and well-attested method for decreasing MySQL's memory footprint is to disable its Performance Schema feature by setting performance_schema = 0
in /etc/mysql/my.cnf
.
However, no answer I've seen yet makes any mention of what exactly this feature does, why it's enabled by default, and the implications of disabling it. To me it seems too be good to be true, and while I'm all for optimisation, I also don't want to compromise the integrity of my database.
Disabling performance schema is perfectly fine and will save you some of that memory.
No, it's not too good to be true. To say that you're compromising something is misleading. It's left on by default because it can be useful and in most cases people can spare the memory, but like any tool you only need it if you're going to use it. If you're not going to use it, you're absolutely free to turn it off with no negative impact at all.
A small droplet that you run for a personal project is exactly the kind of use case where you would want to turn it off.
Plus, you can always turn it on if you decide you need it (with the caveat that you wouldn't have historical data).