Introduction To PostgreSQL

Posted By Hotam Singh | 08-Sep-2018

Hi Guys, In today's topic, we will be discussing PostgreSQL. We have mostly come across MySQL, Oracle, MongoDB. Today I am giving a brief introduction to PostgreSQL.

 

What is PostgreSQL?

 

PostgreSQL is an open source database i.e ORDBMS(Object relational database Management System). it had been developed at Berkeley engineering science Department, California(University of California). Postgres is offered beneath PostgreSQL license and free to use. you're free to use, modify and distribute PostgreSQL in any form.

 

PostgreSQL features highlights

 

1. User-defined types
2. Table inheritance
3. Sophisticated locking mechanism
4. Foreign key referential integrity
5. Views, rules, subquery
6. Nested transactions (savepoints)
7. Multi-version concurrency control (MVCC)
8. Asynchronous replication

 

What makes PostgreSQL stand out

 

* PostgreSQL is the initial database management system that implements multi-version concurrency control (MVCC) feature, even before Oracle. Earlier the       MVCC feature is known as snapshot isolation in Oracle.
* User can define your own data types, index types, functional languages, etc.
* Adding a new optimizer(Custom Plugin).
* You will get huge support from community, an active community is available to help.

 

Who is using PostgreSQL

 

Many companies are using built in products and solutions using PostgreSQL. Some of the popular companies using PostgresQL are Apple, Fujitsu, Red Hat, Cisco, Juniper Network, etc.

 

Connect to database

To connect to postgres database server, run below command:

$ sudo -su postgres psql 

If successfully connected, you will see like below image:

 

Check Postgres installed or not

 

View server version

$ SHOW server_version;

OR

To find the PostgresQL server version from the shell command, simply issue a postgres command with the -V flag (for version):

$ postgres -V

postgres (PostgreSQL) 10


 

If postgresQL command is not found, you need to locate the directory of the utility. This can be done by issuing the

$ locate bin/postgres

Now with the direct path to the listed postgres utility, you can call it with the -V flag as illustrated above:

$ /usr/lib/postgresql/10/bin/postgres -V

Output:
postgres (PostgreSQL) 10.5 (Ubuntu 10.5-1.pgdg16.04+1)

 

Check client version

To check postgres client version, issue below command from the  postgres-server shell:


$ SELECT VERSION();

Output looks like:

OR 

To check client version, again simply pass the -V flag to the psql client utility command:

$ psql -V

Similar if you cannot find the Postgres version – or have multiple installations of PostgreSQL on that machine – you can easily locate psql:

$ locate bin/psql

Output looks like:

Now issue a direct call to the located psql utility for the version:

$ /usr/lib/postgresql/10/bin/psql -V

Request for Proposal

Recaptcha is required.

Sending message..