Revision 117 (by dpavlin, 2003/07/21 16:05:42) use select query and not \d
#!/bin/sh

# count number of records in all tables

if [ -z "$1" ] ; then
	db="webpac-dev"
else
	db=$1
fi

echo "records in $db, by table"
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