PostgreSQL version : 11.2 OS : RHEL 7.5

I am new to PostgreSQL. I would like to know which is the ideal way to start 'Database server' . In Oracle world, we call this starting the instance.

Should I be using Option A or Option B ?

Option A. As root user , run

# systemctl start postgresql-11

Option B. As postgres user, run

$ postgres -D /var/lib/pgsql/11/data

NB: For Option B, PostgreSQL 11's official doc mentions a different directory (/usr/local/pgsql/data) as shown below . Maybe the doc not updated.

$ postgres -D /usr/local/pgsql/data



2 Answers 2


I would prefer option A.

Using systemctl ensures the service is properly (re)started when the computer is (re)started.

As far as the location of the data directory is concerned: the manual shows some defaults. The actual location of the data directory is essentially driven by the packager that built the RPM (or whatever package the OS uses) and the standards the distribution expects or uses. You could also put it under /databasedata/postgres/pg11/data if you want, or /very/important/data/postgres


I prefer Option B, because that is the recommended way to restart the PostgreSQL instance.

As you mentioned, in Oracle we have different ways of stopping and starting instance, even in PostgreSQL we have the same, just check pg_ctl --help

you will get different options to stop the database.

and regarding, /usr/local/pgsql/data, that was just a directory where database files installed, you can install any location you want when doing initdb.

I hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.