Postgres

De Admin -- TALEVAS.
(Différences entre les versions)
(la taille des index)
Ligne 23 : Ligne 23 :
 
=== la taille des index ===
 
=== la taille des index ===
 
  postgres=# select pg_size_pretty(pg_total_relation_size('tableXX') - pg_relation_size('tableXX'));
 
  postgres=# select pg_size_pretty(pg_total_relation_size('tableXX') - pg_relation_size('tableXX'));
 +
 +
 +
#!/bin/bash
 +
for base in `psql -c "select datname from pg_database;" | grep -v "datname" |grep -v \- |grep -v "rows"|grep -v "postgres"`;
 +
do
 +
 +
for table in `psql $base -c "\d"| grep -v "List of relations" |grep -v + |grep -v rows |grep -v Name |cut -d "|" -f 2`;
 +
do echo $table;
 +
        psql $base -c "select pg_size_pretty(pg_total_relation_size('$table') - pg_relation_size('$table'));";
 +
        echo "##########";
 +
done
 +
done

Version du 4 juillet 2012 à 12:53

Sommaire

PG -- PostgreSql

Streaming Replication

Fichiers de config

Le param "config_file" permet de changer le PATH vers le postgresql.conf (i.e. ne pas ne le mettre dans le DATADIR) et donc du streaming.cong (un include) c'est un param à passer dans le ligne de commande du binaire. Donc dans le script d'init.

Il passe très bien dans le -D de l'init et si le data_directory est bien set dans le postgresql.conf

postgresql.conf
streaming.conf  => include dans le postgresql.conf contient les conf spécifiques au streaming
recovery.conf  => les param pour que le slave (standby) sache aller se remonter à partir du master.


faut tester un peut plus tout ça ....


[DOC PG -> http://www.postgresql.org/docs/9.0/static/warm-standby.html#STREAMING-REPLICATION] "Streaming replication is asynchronous, so there is still a small delay between committing a transaction in the primary and for the changes to become visible in the standby. The delay is however much smaller than with file-based log shipping, typically under one second assuming the standby is powerful enough to keep up with the load. With streaming replication, archive_timeout is not required to reduce the data loss window."

Utiles

la taille des index

postgres=# select pg_size_pretty(pg_total_relation_size('tableXX') - pg_relation_size('tableXX'));


#!/bin/bash
for base in `psql -c "select datname from pg_database;" | grep -v "datname" |grep -v \- |grep -v "rows"|grep -v "postgres"`;
do

for table in `psql $base -c "\d"| grep -v "List of relations" |grep -v + |grep -v rows |grep -v Name |cut -d "|" -f 2`;
do echo $table;
       psql $base -c "select pg_size_pretty(pg_total_relation_size('$table') - pg_relation_size('$table'));";
       echo "##########";
done 
done