Database recommendation: Is PostgreSQL really a first class citizen?


quite new to Gitea and tinkering out a setup. Now I have to decide whether to use PostgreSQL or MySQL on Linux (SQLite is not an option for me). I would favor PostgreSQL a lot.

Which DB would you choose when starting to introduce Gitea in an organization?

Is there some kind of “in-official” recommendation? The documentation states both are first class citizens and during tests, I had no problems with PSQL.

But: when reading through the documentation and examples, there seems to be a tendency that most of the devs and the community are using MySQL - is this correct?
My worries are hidden bugs in migrations, backup & restore and stuff. Problems with things not needed everyday are more likely to happen with PostgreSQL than MySQL if the test coverage is not the same and devs are taking care of MySQL more.

What do you think? Anything speaking against PostgreSQL for Gitea?


1 Like

Postgres is most certainly a first-class citizen of Gitea. I (one of the project leads of Gitea) use Postgres for my personal instance. Test coverage is equal for both mysql and postgres (also mssql, and sqlite have the same amount of coverage too). For DB backups though I recommend that you use direct DB tools (such as pg_dump), as they can give you incremental backups, cron backups, backup to S3, etc… and this recommendation applies for all DB types.

1 Like


thank you so much for your input. Going to use PostgreSQL. :slight_smile:

For backup: Sure. Will do a wrapper script dumping the db beside and using gitea dump -c /etc/gitea/app.ini afterwards… storage does not matter in this case, so having another dump created with the native pg_dump laying beside does not hurt.

I always hear that PostgreSQL is the big guy, for the comparatively highest demands among SQLite, MySQL and PostgreSQL. Some time ago I just generally decided to use PostgreSQL for pretty much any server, where I can decide which database to use, because I never wanted to be at some point suddenly restrictred by MySQL or worse, SQLite. So I got used to it and so far I am satisfied with its performance. I also don’t see much of a difference in the difficulty between MySQL and PostgreSQL which is often pointed out in comparisons.