nextcloudpi icon indicating copy to clipboard operation
nextcloudpi copied to clipboard

Optimize database with mysqlcheck

Open feutl opened this issue 4 years ago • 4 comments

After running NC with NCP for more then a year with over 2 million files stored on it, I asked myself if the mysql/mariadb DB needs to be maintained? I searched the internet and the simplest solution I found was using

sudo mysqlcheck -o --all-databases

This reduced the DB size from around 950MB to a little over 800MB and NC seems to be a little more responsive (but this could homeopathic as well)

Any, would it make sens to extend NCP with an "DB Optimize" option?

5 Days after the optimization plus an upgrade to NC 16.0.4 I am still under 850MB. I am fetching the information via ocs_data_server_database_size provided by serverinfo.

feutl avatar Sep 04 '19 11:09 feutl

not a bad idea!

nachoparker avatar Sep 06 '19 16:09 nachoparker

I've added this feature to NCP (see above pull request 1852 ). Question: Should this feature be added to happen automatically? Like db-optimize-auto triggered e.g. on a weekly or monthly basis?

schoetju avatar Nov 25 '23 18:11 schoetju

@schoetju Imo, it should be automatic. If I understand it right, we don't even need to expose it in the admin interface - a weekly Cronjob would be enough.

This means, I'd probably integrate it into lamp.sh 🤔

theCalcaholic avatar Nov 29 '23 16:11 theCalcaholic

I see it the same way. It doesn't need the admin interface (however - it's been easier for me to work it out like this). Instead it should be added as a weekly CRON job directly during the new installation or during the NCP version update. @theCalcaholic Happy, if you can move on with integrating it.

schoetju avatar Nov 29 '23 19:11 schoetju