Skip to main content
Hosted Postgres, bring-your-own setup, backfill tips, and provider-specific notes (Aurora, Supabase, Neon, self-hosted) are documented on the Turbo PostgreSQL sink page and apply to Mirror as well. This page covers Mirror-specific basics only.
PostgreSQL is a powerful, open source object-relational database system used for OLTP workloads. Mirror supports PostgreSQL as a sink, letting you write data directly into PostgreSQL. This provides a robust and flexible solution for both mid-sized analytical workloads and high performance REST and GraphQL APIs. When you create a new pipeline, a table is automatically created with columns from the source dataset. If a table already exists, the pipeline writes to it. You can set up partitions before you set up the pipeline, which lets you scale PostgreSQL even further. The PostgreSQL sink also supports Timescale hypertables if the hypertable is already set up. We have a separate Timescale sink in technical preview that automatically sets up hypertables for you. Contact support@goldsky.com for access. Full configuration details for the Mirror PostgreSQL sink are available in the reference page.

Setting up a Postgres database

Both flows are documented on the Turbo Postgres page and apply to Mirror as well:
  • Goldsky-hosted Postgres. Provisioned from the web app (Sinks > New sink > Hosted Postgres, or inline in the pipeline create flow). Requires a Scale plan. Creating the database automatically adds the secret to your account, so there’s no separate goldsky secret create step.
  • Bring your own Postgres. Create a goldsky_writer role, make the database reachable from Goldsky, and store the connection string as a Goldsky secret.
See also: backfill tips and provider-specific notes (Aurora, Supabase, Neon, self-hosted).

Example: Mirror pipeline writing to PostgreSQL

This pipeline gets a real-time edge stream of raw logs straight into a Postgres table named eth_logs in the goldsky schema, using the secret A_POSTGRESQL_SECRET.
Example PostgreSQL pipeline
name: ethereum-raw-logs-to-postgres
apiVersion: 3
sources:
  my_ethereum_raw_logs:
    dataset_name: ethereum.raw_logs
    version: 1.0.0
    type: dataset
    start_at: latest
transforms:
  logs:
    sql: |
      SELECT
          id,
          address,
          topics,
          data,
          block_number,
          block_hash,
          transaction_hash
      FROM
          my_ethereum_raw_logs
    primary_key: id
sinks:
  my_postgres_sink:
    type: postgres
    table: eth_logs
    schema: goldsky
    secret_name: A_POSTGRESQL_SECRET
    from: logs