ported 257:258 from hidra branch
[webpac] / tools / count_tables.sh
1 #!/bin/sh
2
3 # count number of records in all tables
4
5 if [ -z "$1" ] ; then
6         db="webpac-dev"
7 else
8         db=$1
9 fi
10
11 echo "records in $db, by table"
12 psql $db -A -t -c "select tablename from pg_tables where tablename not like 'pg_%'" | xargs -i psql $db -A -t -F "      " -c "select count(*),'{}' from {}" | sort -nr