I am wondering if there is a convention on where to store the data folder containing all the files for the tables and rows of a relational database system such as Postgres.
On OpenBSD, the (OpenBSD)
postgresql-server package will be preconfigured to use
/var/postgresql/data for its databases. It also adds a
_postgresql service user with
/var/postgresql as its home directory.
Storing databases under
/var makes sense as they generally contain variable data. If your
/var partition is not big enough, you may consider changing this to some other location where you have more space, or mounting a separate filesystem at
/var/postgresql. Unfortunately, I'm not a FreeBSD user and can not tell you how to do that in the most convenient way for PostgreSQL on FreeBSD.
On OpenBSD, changing the location of the data directory would involve changing a
datadir variable in the
/etc/rc.d/postgresql (this particular variable does not seem to be configurable through the native
rcctl utility for whatever reason).
From a comment by JdeBP: For FreeBSD, the default location for the databases is
/var/db/postgres/data10 (presumably this is for PostgreSQL 10). This is configurable by changing/setting the value of the
postgresql_data variable in