PostgreSQL 12 provides significant performance and maintenance enhancements to its indexing system and to partitioning.
B-tree Indexes, the standard type of indexing in PostgreSQL, have been optimized in PostgreSQL 12 to better handle workloads where the indexes are frequently modified. Using a fair-use implementation of the TPC-C benchmark, PostgreSQL 12 demonstrated on average a 40% reduction in space utilization and an overall gain in query performance.
update the apt by typing,
$ sudo apt update
Add PostgreSQL 12 repository
We need to import GPG key and add PostgreSQL 12 repository
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Okay, the key is now imported, now lets add repository details.
$ echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list
Let’s Install PostgreSQL now
$ sudo apt update $ sudo apt -y install postgresql-12 postgresql-client-12
PostgreSQL is installed now. now let’s add some basic settings. Enable system settings.
$ sudo systemctl status postgresql.service $ sudo systemctl enable postgresql.service
Now the PostgreSQL has superuser named postgres. Now it has default peer authentication, which is The peer authentication method works by obtaining the client’s operating system user name from the kernel and using it as the allowed database user name (with optional user name mapping). This method is only supported on local connections.
by default, the PostgreSQL user has no password. add one,
$ sudo su - postgres $ psql $
alter user postgres with password 'pleasechangeme'$ \q
So if you want to setup a development environment, Md5 authentication is recommended. So lets change it to Md5 . To do that, we have to make some changes in /etc/postgresql/12/main/pg_hba.conf.
from the above screenshot, you can see that postgres is in peer authentication. make it as md5. see the modified one below.
Allow remote connections to PostgreSQL Server
At this time, your postgres server won’t respond to any connections from out side. let’s enable it by a simple change. Edit your /etc/postgresql/12/main/postgresql.conf as follows .
always keep in mind that, this change will make our server capable of accepting requests from all over the world. And this is how I installed postgres12 on ubuntu.