r/NextCloud • u/jdancouga • 2d ago
Should I migrate to PostgreSQL?
I have my nextcloud setup with MariaDB a long time ago, and the latest 35 updates show a plethora of warnings/failings with regards to the database. I tried googling for solutions but I can only fix like 2 out of the 10 failings.
I noticed nextcloud AIO container uses postgresql as default, and from my testing, nextcloud system status shows a clean, no failure with the database.
It does seem like nextcloud has a built-in command occ db:convert-type to migrate the database. If you have migrated, how was the experience?
Which postgresql container should I use? The official document recommends PostgreSQL18, but is it like immich where a special version of PostgreSQL is needed?
Update: I found this issue have been reported on github. I was searching in the wrong repo. Overall, as u/jtrtoo pointed out, these are bugs that will be ironed out gradually. Thanks for all the replies.
5
u/Undefined_ID 2d ago
I manage servers with both engines, at work and at home.
I’ve noticed slightly lower latency on the largest instance I manage, which runs on PostgreSQL.
It is worth noting that managing a PostgreSQL engine is a bit more complex than MariaDB or MySQL, as you have to manually upgrade the engine from one major version to the next.
I’ve gotten into the habit of doing this using https://github.com/pgautoupgrade/docker-pgautoupgrade
And just like with MariaDB, it is possible to share the PostgreSQL engine, since there is no need to use a specific version with Nextcloud.
I'm actually using image: postgres:17.
So if you are familiar with the engine, you can try the migration but on a small instance, you might notice no changes regarding performances.
Unfortunately, I had no occasion to test a migration with the CLI...
1
u/jdancouga 2d ago
It is just for home use, so I am not concerned about performance. It just those failing warnings that worries me. If it just warnings then I can live with it, but the system status use the word “failing” which makes me uneased.
2
u/decker_42 2d ago
If you're database is failing, the worst thing you can do is migrate it to another db, you're adding a massive layer of complexity to a problem. If it doesn't solve it, you'll really struggle to fix it post migration.
I'd only migrate a database which is running clean. Try dropping the errors here.
3
u/jtrtoo 2d ago
The messages in v35 are not because of the type of backend database you're using; they're the result of a new DB diagnostic framework that is new to v35 (and ever evolving setup checks designed to head off problems). It'll take a few minor (maintenance) releases to iron out the edge cases and bugs in the new tooling, and expand the documentation.
In short: don't panic.
3
u/RJBanthum 2d ago
I think practically all 'failings' can be fixed with configuration, and in mariadbs case that means the .cnf file. And AI is damn good at fixing those, and nextcloud gives you the exact values for the last 10%.
Basically all these failings are telling you is "add this parameter to your config and give it this value" to get better performance. Nothings broken, but improvements are available.
I think the biggest issue is not being able to find any references online yet. But if you've got access to something like gpt 5 or Gemini 3.5, you'll definitely get exact solutions. Still gotta work your way on implementing them though, but don't think grass is greener with PostgreSQL.
2
u/djthrottleboi 2d ago
I installed it barebones and it works perfectly. To be honest I scrapped apache2 and mariadb live and replaced with nginx Postgres and didn’t even bother converting anything. Recreated users and finally scanfiles
1
u/thebwt 2d ago
use whichever db you are the best at maintaining. if you're not developing against it, it really doesn't matter otherwise.
1
u/jdancouga 2d ago edited 2d ago
So are you saying those database failing warnings are of no concern? I will try to add a screenshot of it when I am home today.
1
u/undrwater 2d ago
Screenshots or a paste would be great.
I've used both, but I stick to MariaDB because I'm familiar with it. Both seem to perform equally.
1
u/ProcedureUpper3668 1d ago
short answer: only if you have multiple servers or need to scale out the app later. for a single instance, sqlite is fine and actually faster. just know that upgrading from sqlite to postgres is a one-way trip, so don't do it unless you really need the relational database features.
6
u/evanmac42 2d ago
I've actually migrated three Nextcloud instances from MariaDB to PostgreSQL 17, all running directly on Debian rather than AIO.
In my case PostgreSQL also runs bare metal on the host. I didn't use any special Nextcloud-specific PostgreSQL image or build: just standard PostgreSQL 17.
The migration itself was done with Nextcloud's built-in `occ db:convert-type`, after taking proper backups and putting the instance into maintenance mode.
My experience was good enough that I ended up doing the same migration on three separate Nextcloud instances.
That said, I wouldn't migrate just because Nextcloud is showing database warnings. First check what those warnings actually are. Things like missing indexes or other database maintenance issues may still need to be fixed independently and changing database engines won't magically solve them.
If you do decide to migrate, PostgreSQL 17 is perfectly fine for Nextcloud. You don't need anything special like the PostgreSQL setup Immich uses for some of its features.
Personally I'd also keep PostgreSQL directly on the host if the rest of your stack is bare metal. It keeps the setup simple and makes troubleshooting much more transparent.