Nextcloud database optimalization


Is there any way to optimalize a nextcloud database?

My DB (postgres) is more than 1 GB big, data storage contains 230 GB of data. I think It causes slower perfomance.

Any idea, please?
Thanks in advance,

The first things you can do is confirm there are no db index warnings under Admin->Basic Settings.


  1. Follow the advice in the Server Tuning section of the Admin Manual (not just for the db).
  2. Disable unnecessary NC apps, particularly ones that have a lot of overhead like - e.g. antivirus, office previews - if you feel you can live without them
  3. Share details of your setup here and others may have feedback and ideas (for example: I posted benchmarks comparing Alpine based Docker containers for Redis that showed significant performance differences by ditching Alpine)
  4. Rather than guessing, take a look at things like htop, iostat, vmstat, etc. during particularly slow use cases to learn what the constraints are in your environment
1 Like

Thank you for reply, jtr.

I’ve tried all the steps from Server tunning part of the manual, none of them made any bigger improvement in my environment.

Then I rebuilt the database by creating a new db from sql dump and dropping the old one. The DB size reduced by a third. I’ve also doubled memory limit and cut off some unused external storages and the performance seems to be better so far.

It is already some time now - the DB size is back on its original size - but the overall performance is still better than before.

Thanks though.
Have a nice day.

Can you share a little about the platform you’re running your Nextcloud stack in?

And what, specifically, is slow?

My instance of Nextcloud is running on my own dedicated refurbished Dell server R610 poweredge with 16 GB RAM and two RAID1 SAS HDDs (system and nc data storage) on Ubuntu 20.04. Postgres12 DB host is running on the same machine. A few other apps are running on the server: PHP 8.1, Nginx reverse proxy and private website hosting, Collabora coolwsd standalone and a Docker with Budibase app.

In our company the main purpose of NC is to share files from/to external local smb storage over the team of cca 20 users. Main apps are Files, Photos and Deck. Then document editing and Calendar, Task and few other.

Since I’ve enlarged PHP memory limit to 8 GB and rebuilt a DB from dump, the perfomance improved a lot.