Middle
What PostgreSQL utilities do you know and have used?
sobes.tech AI
Answer from AI
There are many utilities in PostgreSQL that are actively used for administration, backup and data recovery, as well as for working with the database:
- psql — an interactive command shell for executing SQL queries and database administration.
- pg_dump — a utility for creating backups of the database in various formats.
- pg_restore — a tool for restoring a database from a backup created by pg_dump.
- pg_ctl — managing the start and stop of the PostgreSQL server.
- createdb and dropdb — creating and deleting databases.
- createuser and dropuser — managing database users.
- pg_stat_statements — an extension for collecting statistics on executed queries.
- vacuum and vacuumdb — cleaning and optimizing the database.
Example of using pg_dump for backup:
pg_dump -U username -F c -b -v -f backup_file.backup dbname
This command will create a compressed backup of the database dbname with the specified username.