Postgres Introduction

Tín Huỳnh
3 min readFeb 18, 2022

--

What is Postgres?

PostgreSQL is an enterprise-class open source database management system. It supports both SQL and JSON for relational and non-relational queries for extensibility and SQL compliance. PostgreSQL supports advanced data types and performance optimization features, which are only available in expensive commercial databases, like Oracle and SQL Server. It is also known as Postgres.

Introduction to postgres

It is backed by an experienced community of developers who have made tremendous contributions to make it a highly reliable DBMS system.

Why use PostgreSQL?

PostgreSQL comes with many features aimed to help developers build applications, administrators to protect data integrity and build fault-tolerant environments, and help you manage your data no matter how big or small the dataset. In addition to being free and open source, PostgreSQL is highly extensible. For example, you can define your own data types, build out custom functions, even write code from different programming languages without recompiling your database!

PostgreSQL tries to conform with the SQL standard where such conformance does not contradict traditional features or could lead to poor architectural decisions. Many of the features required by the SQL standard are supported, though sometimes with slightly differing syntax or function. Further moves towards conformance can be expected over time. As of the version 14 release in September 2021, PostgreSQL conforms to at least 170 of the 179 mandatory features for SQL:2016 Core conformance. As of this writing, no relational database meets full conformance with this standard.

Below is an inexhaustive list of various features found in PostgreSQL, with more being added in every major release:

Data Types

  • Primitives: Integer, Numeric, String, Boolean
  • Structured: Date/Time, Array, Range / Multirange, UUID
  • Document: JSON/JSONB, XML, Key-value (Hstore)
  • Geometry: Point, Line, Circle, Polygon
  • Customizations: Composite, Custom Types

Data Integrity

  • UNIQUE, NOT NULL
  • Primary Keys
  • Foreign Keys
  • Exclusion Constraints
  • Explicit Locks, Advisory Locks

Concurrency, Performance

  • Indexing: B-tree, Multicolumn, Expressions, Partial
  • Advanced Indexing: GiST, SP-Gist, KNN Gist, GIN, BRIN, Covering indexes, Bloom filters
  • Sophisticated query planner / optimizer, index-only scans, multicolumn statistics
  • Transactions, Nested Transactions (via savepoints)
  • Multi-Version concurrency Control (MVCC)
  • Parallelization of read queries and building B-tree indexes
  • Table partitioning
  • All transaction isolation levels defined in the SQL standard, including Serializable
  • Just-in-time (JIT) compilation of expressions

Reliability, Disaster Recovery

  • Write-ahead Logging (WAL)
  • Replication: Asynchronous, Synchronous, Logical
  • Point-in-time-recovery (PITR), active standbys
  • Tablespaces

Security

  • Authentication: GSSAPI, SSPI, LDAP, SCRAM-SHA-256, Certificate, and more
  • Robust access-control system
  • Column and row-level security
  • Multi-factor authentication with certificates and an additional method

Extensibility

  • Stored functions and procedures
  • Procedural Languages: PL/PGSQL, Perl, Python (and many more)
  • SQL/JSON path expressions
  • Foreign data wrappers: connect to other databases or streams with a standard SQL interface
  • Customizable storage interface for tables
  • Many extensions that provide additional functionality, including PostGIS

Internationalisation, Text Search

  • Support for international character sets, e.g. through ICU collations
  • Case-insensitive and accent-insensitive collations
  • Full-text search

Advantage of PostgreSQL

Below are the main advantages of PostgreSQL:

  • PostgreSQL can run dynamic websites and web apps as a LAMP stack option.
  • PostgreSQL’s write-ahead logging makes it a highly fault-tolerant database.
  • PostgreSQL source code is freely available under an open source license. This allows you the freedom to use, modify, and implement it as per your business needs.
  • PostgreSQL supports geographic objects so you can use it for location-based services and geographic information systems
  • PostgreSQL supports geographic objects so it can be used as a geospatial data store for location-based services and geographic information systems
  • To learn Postgres, you don’t need much training as its easy to use
  • Low maintenance and administration for both embedded and enterprise use of PostgreSQL

Disadvantage of PostGRESQL

Below are the disadvantages of PostgreSQL:

  • Postgres is not owned by one organization. So, it has had trouble getting its name out there despite being fully featured and comparable to other DBMS systems
  • Changes made for speed improvement requires more work than MySQL as PostgreSQL focuses on compatibility
  • Many open source apps support MySQL, but may not support PostgreSQL
  • On performance metrics, it is slower than MySQL.

Download and Install Postgres, click this.

Reference :

https://www.guru99.com/introduction-postgresql.html

https://www.postgresql.org/

--

--