1. What is PostgreSQL









































PostgreSQL is a powerful open source object-relational database system. It was first (started in 1986) as part of the POSTGRES project at the University of California, Berkeley. It has been through more than 30 years and is still being updated and iterated. The latest version is Postgre 15.

PostgreSQL supports most of the SQL standard and provides many other modern features such as complex queries, foreign keys, triggers, views, transaction integrity, multi-version concurrency control, etc.

Likewise, PostgreSQL can be extended in many ways, such as by adding new data types, functions, operators, aggregate functions, indexing methods, procedural languages, etc.



2. Why use PostgreSQL









































Better Licensing : PostgreSQL has an MIT-like license that allows developers to do anything, including commercial use in open-source or closed-source products

Better data consistency : PostgreSQL will perform strict verification before data insertion and update to ensure that the data is legal before performing corresponding operations

Better extensibility : PostgreSQL supports custom data types and supports writing custom functions in multiple languages, including C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, etc.

3 Postgre SQL vs MySQL

PostgreSQL is an object-relational database, while MySQL is a purely relational database.

An object-relational database means that Postgres includes features such as table inheritance and function overloading that may be important for some applications.

● PostgreSQL follows the SQL standard more strictly than MySQL.

● PostgreSQL handles concurrency better than MySQL:

picture

Postgres implements multi-version concurrency control (MVCC) without read locks

Postgres supports parallel query plans that can use multiple CPUs/cores

Postgres can create indexes in a non-blocking way (via the CREATE INDEX CONCURRENTLY syntax), it can create partial indexes

● PostgreSQL has better data consistency than MySQL

4 Why PostgreSQL is not as popular as MySQL in China

Compared with the latest versions of MySQL and PostgreSQL, the performance of PostgreSQL is actually more powerful, but the reason why MySQL is not popular is mainly due to historical reasons.

● MySQL is simpler to use and easier to install on the Windows platform. The early PostgreSQL did not provide a version for the Windows platform and needed to be compiled by itself

Learning MySQL is easier , out of the box, connecting as root user is very simple, but configuring PostgreSQL, creating users, etc. is more complicated than MySQL

● MySQL has always been endorsed by the company , creating an ecosystem of communities and supporting products, both online documents and forums are richer than Postgre SQL

The database products mainly used by domestic Internet companies are still mainly MySQL. Those who want to learn MySQL systematically can follow the video tutorials below.

picture

MySQL knowledge intensive + practical cases