Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 2.01 KB

postgresql.md

File metadata and controls

46 lines (34 loc) · 2.01 KB

PostgreSQL on Ubuntu 18.04 (with APT)

NOTICE: Use https://www.postgresql.org/download/linux/ubuntu/ to find proper installation instructions

Step 1: install postgressql-12.xx

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sh -c 'echo deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main > /etc/apt/sources.list.d/pgdg.list'
apt update
apt install postgresql-12 libpq-dev

Step 2: tune PostgreSQL

Step 3: enable pg_stat_statements

ALTER SYSTEM SET shared_preload_libraries TO 'pg_stat_statements';
# service postgresql restart
ALTER SYSTEM SET pg_stat_statements.track TO 'all';
ALTER SYSTEM SET pg_stat_statements.max TO 10000;
ALTER SYSTEM SET track_activity_query_size TO 2048;
SELECT pg_reload_conf();

Replication

Backup