Useful commands
Get Database size
SELECT pg_database.datname, pg_size_pretty(pg_database_size(pg_database.datname)) AS size FROM pg_database;
Example:
datname | size -----------+--------- postgres | 3905 kB prelude | 22 GB
Resetting a sequence
To reset a sequence so that the next time it's used it returns 1:
select setval('my_sequence_seq', 1, false);
The first parameter is the sequence name to set the value of, the next is the value to set it to, and the third field is whether the sequence should return this value or the next increment when it is used next.
