Catégorie : Postgresql
-
Show replication status in PostgreSQL
https://www.niwi.nz/2013/02/16/replication-status-in-postgresql/ select client_addr, state, sent_location, write_location, flush_location, replay_location from pg_stat_replication; This query can output can be like this: postgres=# select client_addr, state, sent_location,write_location, flush_location, replay_location, sync_priority from pg_stat_replication;
-
Disable Streaming Replication without restarting either master or slave
I understand the way things work currently, but would it not be moreconvenient to let the replication be stopped and started from SQL commandslike: On Master: select pg_pause_streaming_replication(slave_fqdn);select pg_resume_streaming_replication(slave_fqdn); On […]
-
Lancement de pgAdmin4
(pgadmin4) titi@serveur:~/home-global/virtualenv/myVE/lib/python2.7/site-packages/pgadmin4/pgadmin4/lib/python2.7$ cd /home/titi/home-global/virtualenv/myVE/lib/python2.7/site-packages/pgadmin4/(pgadmin4) titi@serveur:~/home-global/virtualenv/myVE/lib/python2.7/site-packages/pgadmin4$ python pgAdmin4.pypgAdmin 4 – Application Initialisation====================================== The configuration database – ‘/home/titi/.pgadmin/pgadmin4.db’ does not exist.Entering initial setup mode…NOTE: Configuring authentication for SERVER mode. Enter the email […]
-
.pgpass
Utilisation du .pgpass : https://newfivefour.com/postgresql-pgpass-password-file.html attention l’utilisation du .pgpass ne fonctionne pas avec une connexion LDAP : psql: FATAL: authentification LDAP échouée pour l’utilisateur « titi»
-
Localiser ses données en Postgres
dev=# select oid,datname from pg_database; oid | datname ——-+———– 13275 | postgres 1 | template1 13274 | template0 16388 | dev(4 lignes)dev=# q[postgres@titi 16388]$ ls -l $PGDATA/basetotal 24drwx—— 2 postgres users 4096 25 […]
-
Trouver un objet particulier en Postgres
select oid,relfilenode,relname from pg_class where relfilenode=’16826′; oid | relfilenode | relname ——-+————-+———————– 16804 | 16826 | table_totooudev=# select oid,relfilenode,relname from pg_class where relname=’table_toto’;
-
Afficher les fonctions internes PostgreSQL
Pour afficher les fonctions internes présentes sur le système : db=#select * from pg_proc;
-
Afficher les verrous
SELECT pg_class.relname, pg_locks.* FROM pg_locks, pg_class WHERE pg_locks.relation = pg_class.oid;
-
Optimiser requete sql pour postgres
Installer au préalable le module : pg_stats_statements Exécuter la requête suivante : SELECT * FROM pg_stat_statements ORDER BY total_time DESC;