What is difference between pg_ctl and systemctl in PostgreSQL

In this article, we will see the difference between pg_ctl and systemctl in PostgreSQL.

Difference between pg_ctl and systemctl in PostgreSQL

Continue reading What is difference between pg_ctl and systemctl in PostgreSQL

How to start stop PostgreSQL server using pg_ctl

In this article, we will see how to start stop PostgreSQL server using pg_ctl.

We can start or stop or promote PostgreSQL server(cluster) by using following three methods.

1. Using pg_ctl
2. Using Systemctl
3. Using service

Last two methods are straight forward.

How to start stop restart PostgreSQL server using pg_ctl

pg_ctl is the utility used to start stop status or promote/failover of PostgreSQL cluster(server).
To use pg_ctl to start the PostgreSQL, we must have an already existing or newly initialized data directory.
We have to use PostgreSQL server data directory location while using pg_ctl.

Before going to examples, set the PostgreSQL environment variables using this link

Syntax of pg_ctl: Continue reading How to start stop PostgreSQL server using pg_ctl

How to find the PostgreSQL server uptime

In this article, we will see how to find the PostgreSQL server uptime. To find the PstgreSQL server uptime, we use PostgreSQL built-in function pg_postmaster_start_time(). Or by checking the time host and postgresql server start time.

Find the PostgreSQL server uptime

Continue reading How to find the PostgreSQL server uptime

PostgreSQL Server Shutdown modes

In this article, we will different PostgreSQL Server Shutdown modes.

Like other RDMS, in PostgreSQL also there are threes modes in which a shutdown can be performed.

1. Smart Mode
2. Fast Mode
3. Immediate Mode

Continue reading PostgreSQL Server Shutdown modes

How to enable archive mode in PostgreSQL

In this article, we will see how to enable archive mode in PostgreSQL. Archive mode is not enabled by default in PostgreSQL.

What is archiving

Archiving is the concept to store history in a safe location. This also helps with Point In Time Recovery(PITR) and also in situations where a standby is lagging behind the primary and requires the recently removed WAL segments to get back to sync.

Steps to enable archive mode in PostgreSQL:
Continue reading How to enable archive mode in PostgreSQL

What is postmaster in PostgreSQL

In this article, we have explained what is postmaster in PostgreSQL.

Postmaster is the first process the cluster executes, and this process is responsible for keeping track of the activities of the whole cluster. The postmaster forks itself into a backend process every time a new connection established to PostgreSQL Server.
Continue reading What is postmaster in PostgreSQL

PostgreSQL Directory Layout

In this article, we will see PostgreSQL Directory Layout and their purpose.




PostgreSQL Database Directory Layout

 

Installation Directory Layout:

 

     
PostgreSQL is typically installed
to /usr/local/pgsql or /var/lib/pgsql on linux.

     
C:\Program
Files\PostgreSQL\<version number> on windows.

Continue reading PostgreSQL Directory Layout

psql: could not connect to server: Connection refused

In this article, we will the solution for below error.

psql: could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?

psql could not connect to server Connection refused
Continue reading psql: could not connect to server: Connection refused

psql: FATAL: the database system is starting up

In this article, we will the solution for below error.

psql: FATAL: the database system is starting up

psql FATAL the database system is starting up

Continue reading psql: FATAL: the database system is starting up

How to check PostgreSQL is running or not

In this article, we will see how to check PostgreSQL is running or not on Linux and Windows.

Following commands are used to check the status of PostgreSQL is running or not on Linux Operating Systems. There are several ways to find out
Continue reading How to check PostgreSQL is running or not