sysadmin:postgresql
This is an old revision of the document!
Table of Contents
Basi di configurazione
- eseguire
/usr/local/sbin/postgresql_shmall_shmmax.sh » /etc/sysctl.conf
- installare
pgtune
per un tuning grezzo di PostgreSQL sulla macchina - eseguire
pgtune -i /etc/postgresql/9.1/main/postgresql.conf | grep pgtune » /etc/postgresql/9.1/main/postgresql.conf
- abilitare i log su stderr seguendo la documentazione di pgbadger
- NOTA LOG: attualmente su befair2 i log sono in
/var/lib/postgresql/9.1/main/pg_log/
vediamo come si comporta postgresql con rotazione e compressione
Performance
- Performance Tuning: http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
- Ottimo articolo segnalato da AndreaF http://www.revsys.com/writings/postgresql-performance.html
Query comode x debug
- Processi attivi:
select * from pg_stat_activity;
- Indici presenti:
SELECT * FROM pg_indexes;
- Utilizzo degli indici:
SELECT relid,relname,idx_scan,idx_tup_read,idx_tup_fetch FROM pg_stat_all_indexes WHERE schemaname='public' ORDER BY idx_scan desc;
- Utilizzo delle tabelle:
SELECT * FROM pg_stat_all_tables;
- Lock da https://wiki.postgresql.org/wiki/Lock_Monitoring (ho aggiunto il WHERE nel mio caso)
SELECT a.datname, c.relname, l.transactionid, l.mode, l.granted, a.usename, a.current_query, a.query_start, age(now(), a.query_start) AS "age", a.procpid FROM pg_stat_activity a JOIN pg_locks l ON l.pid = a.procpid JOIN pg_class c ON c.oid = l.relation WHERE mode='RowExclusiveLock' ORDER BY a.query_start;
Avvio manuale di postgres
se service postgresql start offre poca flessibilità usare
pg_ctlcluster 8.4 main start -- -w
o ancora più a basso livello, da utente postgres
eseguire:
/usr/lib/postgresql/8.4/bin/pg_ctl start -D /var/lib/postgresql/8.4/main -w -o '-c config_file="/etc/postgresql/8.4/main/postgresql.conf"'
sysadmin/postgresql.1415141920.txt.gz · Last modified: 2014/11/04 22:58 by feroda