BackUp PostgreSQL with pg_dump
In this post, we are going to find out how to backup postgresql database with pg_dump utility. What is the pg_dump utility PostgreSQL provides the …
SELECT *
FROM pg_stat_activity
WHERE pid <> pg_backend_pid()
AND datname = 'database_name';
For instance, when I connect the database via Spring Boot application, this sql query returns:
datid | 16384
datname | testdatabase
pid | 7849
usesysid | 10
usename | postgres
application_name | PostgreSQL JDBC Driver
client_addr | 127.0.0.1
client_hostname |
client_port | 49008
SELECT *, pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE pid <> pg_backend_pid()
AND datname = 'database_name';
This is pretty easy, just run the following command:
SELECT pg_size_pretty( pg_database_size('db_name_or_table_name') );
-- example:
SELECT pg_size_pretty( pg_database_size('testdatabase') );
Returns: 9793 kB
In this post, we are going to find out how to backup postgresql database with pg_dump utility. What is the pg_dump utility PostgreSQL provides the …
It is crucial to capture long running method execution in your application (whether it is an API or traditional mvc application). You should also …