How does postgresql perform?

Because I just tried it and the performance was horrible. Just wanted to know if that was an issue with my setup or nextcloud.

i would say: postgresql.

may you share some infos about your setup?
did you look e.g. at https://pgtune.leopard.in.ua/#/ for tuning tipps?