1 – verificar processos PostgreSQL:
ps aux | grep “postgres” | grep-v "grep"
ShellScript2 – Status conexão de rede:
netstat-ntu | grep "TIME_WAIT" | wc-l
ShellScript3 – Informações sobre base de dados disponíveis:
SELECT SUM (pg_database_size (OID)) FROM pg_database;
ShellScript4 – Locks:
SELECT * FROM pg_locks;
SELECT COUNT (*) FROM pg_locks;
ShellScriptProcessos ativos:
SELECT COUNT (usename) FROM pg_stat_activity;
ShellScript6 – Cache utilizado:
SELECT SUM (blks_hit) / SUM (blks_read) FROM pg_stat_database;
ShellScript7 – Tamanho da base:
postgres=# SELECT pg_database_size('geekdb');
ShellScript8 – Tamanho real do banco no disco arredondando:
postgres=# SELECT pg_size_pretty(pg_database_size('somedatabase')) As fulldbsize;
ShellScript9 – Tamanho de uma tabela:
postgres=# SELECT pg_size_pretty(pg_total_relation_size('drupal_cache'));
ShellScript10 – Tamanho de todas as tabelas:
relname as "Table",
pg_size_pretty(pg_total_relation_size(relid)) As "Size",
pg_size_pretty(pg_total_relation_size(relid) – pg_relation_size(relid)) as "External Size"
FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;
ShellScript