PostgreSQL: Exporting data from PostgreSQL to your computer

This documentation is part of the Getting started guide. View the full guide here: How to get started with PostgreSQL.

👋 Welcome to the Stackhero documentation!

Stackhero provides a fully managed PostgreSQL cloud service, designed for reliability and speed:

  • Unlimited connections and data transfers for seamless scaling.
  • PgAdmin web UI included for intuitive database management.
  • Popular extensions included, such as PostGIS, TimescaleDB, and PgVector.
  • Simple, one-click updates keep your database secure and current.
  • High performance and strong security on private, dedicated infrastructure.

You can get started with Stackhero's PostgreSQL cloud hosting in just a few minutes. Enjoy a reliable database experience and save valuable time managing your data.

Exporting data from your PostgreSQL instance to your computer is just as straightforward using the PostgreSQL CLI.

  1. To export the entire database (replace <DB_NAME> with your database name):

    pg_dump \
      --host=<XXXXXX>.stackhero-network.com \
      --username=admin \
      --port=<PORT> \
      --dbname=<DB_NAME> \
      > data.pgsql
    
  2. To export a single table (replace <DB_NAME> with your database name and <TABLE_NAME> with your table name):

    pg_dump \
      --host=<XXXXXX>.stackhero-network.com \
      --username=admin \
      --port=<PORT> \
      --dbname=<DB_NAME> \
      --table=<TABLE_NAME> \
      > data.pgsql