PostgreSQL Database Administration

This tutorial series teaches PostgreSQL database administration from scratch to help you effectively manage the PostgreSQL database server.

Section 1. Managing PostgreSQL Databases #

This section teaches you how to efficiently create, change, and manage databases.

  • Create Database – Learn how to create a new database.
  • Drop Database – Drop a database from the PostgreSQL server.
  • Create Roles – Understand the concept of roles in PostgreSQL and how to create roles.
  • Grant Privileges – Grant one or more privileges on a database object to a role.
  • Alter Database – Change database settings, ownership, connection limits, and tablespace assignments of an existing database.
  • Rename Database – Give you the exact steps to rename database safely and effectively.

Section 2. Managing PostgreSQL Schemas #

In PostgreSQL, schemas help organize database objects into logical groups. This section explores how to create, modify, and manage schemas effectively.

  • PostgreSQL Schemas – Discover the concepts of schemas and learn how to use the to group database objects.
  • Create Schema – Learn how to create a new schema.
  • Alter Schema – Rename a schema or change the owner to a new one.
  • Drop Schema – Drop one or more schemas and their objects.

Section 3. Managing PostgreSQL Tablespaces #

  • Tablespaces – Learn about tablespaces and how to create and use them to store database objects including tables and indexes.
  • Alter Tablespaces – How to rename, change the owner, and set or reset a tablespace’s parameters.
  • Drop Tablespaces – Show you how to move database objects out of a tablespace and safely delete it

Section 4. PostgreSQL Roles & Privileges #

  • Revoke Privileges: Remove previously granted privileges with the REVOKE statement.
  • Alter Role: Modify role attributes, rename roles, or set configuration parameters using the ALTER ROLE statement.
  • Drop Role: Safely delete roles, even those with dependent objects.
  • Role Membership: Manage group roles and role memberships for better access control.
  • SET ROLE: Temporarily switch to a group role to perform specific tasks.
  • Row-Level Security (RLS): Implement RLS to restrict access to specific rows based on user-defined conditions, enhancing data security.

Section 5. Backup & Restore PostgreSQL Databases #

This section shows you how to back up and restore PostgreSQL databases.

  • Backup: Use pg_dump and pg_dumpall tools to create logical backups of PostgreSQL databases.
  • Restore: Use pg_restore and psql tools to restore databases from backups.
  • Copy a PostgreSQL Database – Show you step-by-step how to copy a PostgreSQL database within the same database server or migrate it to another database server.

Section 6. PostgreSQL Database Administration Tips #

Boost your productivity and efficiency with these handy PostgreSQL tips.

  • psql Commands: Learn the most commonly used psql commands to effectively interact with a PostgreSQL database.
  • Show Tables: Retrieve the detailed structure of a table.
  • Show Databases: List all databases in a PostgreSQL server.
  • Show Tables: Display all tables within the current database for quick reference.
Was this tutorial helpful ?