Linking Postgres as a source

The Postgres connector can link your database tables to PostHog.

To link Postgres:

  1. Go to the Data pipeline page and the sources tab in PostHog
  2. Click New source and select Postgres
  3. Enter your database connection details:
    • Host: The hostname or IP your database server like db.example.com or 123.132.1.100.
    • Port: The port your database server is listening to. The default is 5432.
    • Database: The name of the database you want like analytics_db.
    • User: The username with the necessary permissions to access the database.
    • Password: The password for the user.
    • Schema: (Optional) The schema for your database. Leave blank to browse and sync tables from all schemas, or specify one to limit the selection. The default is public.
  4. If you need to connect through an SSH tunnel, enable and configure it (optional):
    • Tunnel host: The hostname of your SSH server.
    • Tunnel port: The port your SSH server is listening on.
    • Authentication type:
      • For password authentication, enter your SSH username and password.
      • For key-based authentication, enter your SSH username, private key, and optional passphrase.
    • Require TLS through tunnel? - Whether to require TLS encryption through the SSH tunnel. Enabled by default. Disable if your database does not support TLS.
  5. Click Link

The data warehouse then starts syncing your Postgres data. You can see details and progress in the sources tab.

Configuration

OptionTypeRequired
Connection string (optional)textNo
HosttextYes
PortnumberYes
DatabasetextYes
UsertextYes
PasswordpasswordYes
SchematextNo
Use SSH tunnel?ssh-tunnelNo

Selecting columns

By default, PostHog syncs all columns from each table. To sync only specific columns:

  1. During source setup, click Columns next to any table in the table picker.
  2. Uncheck columns you don't want to sync.
  3. Primary key columns and the incremental sync field (if configured) are always synced and cannot be disabled.

You can also change column selection after setup:

  1. Go to the sources tab and click your Postgres source.
  2. Click Configure next to any schema.
  3. Under Columns, select which columns to sync.
Adding columns to existing syncs

When you add columns to a schema using incremental, append, or CDC sync, PostHog prompts you to choose:

  • Sync forward only - New columns are populated only for future data. Existing rows show NULL for the new columns.
  • Full resync - Triggers a complete resync to backfill the new columns for all rows.
SSL/TLS required for new sources

PostgreSQL sources created after February 18, 2026 require SSL/TLS encryption for database connections. Ensure your PostgreSQL database supports SSL/TLS connections before linking. Existing sources created before this date are not affected. If you're connecting through an SSH tunnel, you can optionally disable TLS using the Require TLS through tunnel? toggle since the tunnel already encrypts the connection.

Permissions The Postgres source only requires read permissions on the schemas and tables you intend to sync.

Looking for an example of the Postgres source? Check out our tutorial where we connect and query Supabase data.

Inbound IP addresses

We use a set of IP addresses to access your instance. To ensure this connector works, add these IPs to your inbound security rules:

USEU
44.205.89.553.75.65.221
44.208.188.17318.197.246.42
52.4.194.1223.120.223.253

Note: We currently don't support connections using IPv6, therefore, you may need to enable IPv4 connections to your database. This is required for Supabase, for example.

Community questions

Was this page useful?

Questions about this page? or post a community question.