Query your Postgres data in PostHog

Connect Postgres to PostHog to connect who your customers are to how they use your product, so you can see which accounts activate and which are ready to upgrade.

What syncs from Postgres

Your schema is your own, so PostHog doesn't sync a fixed list of tables. You choose the tables, columns, and rows, and how each one stays up to date.

Any table or view

Sync tables and materialized views from any schema that PostHog can read.

Pick your columns

Leave out columns you don't want in PostHog, like password hashes or internal notes.

Filter your rows

Add up to 20 row filters per table to sync only recent rows or a single tenant.

Live queries

Query your database directly from the SQL editor, without copying the data into PostHog.

Choose a sync method per table

Change data capture (CDC)

Streams inserts, updates, and deletes through logical replication, in near real time.

Incremental

Pulls changed rows on a schedule, using a cursor column like updated_at.

xmin

Syncs inserts and updates incrementally when your table has no reliable cursor column.

Append-only

Adds new rows on a schedule. Best for event or log tables that only grow.

Full table

Re-copies the whole table each time. Best for small tables that change often.

With CDC, PostHog can keep a current-state table, a full change history table, or both. The history table shows when each row changed, so you can see when an account changed plan.

How to connect Postgres

Paste a connection string or enter your host details, then pick the tables to sync. PostHog connects over TLS from a fixed set of IP addresses you can allowlist, or through an SSH tunnel if your database isn't public. For scheduled syncs, a read-only user is all it needs.

PostHog Wizard hedgehog

Questions you can answer with Postgres and PostHog

Product

Which accounts actually activate?

Join your accounts or organizations table to signup events and find the early actions that separate the accounts that stay from the ones that leave.

Read the guide

How does usage differ by plan, company size, or region?

Use your app tables as dimensions, so you can break down any insight by customer attributes.

Read the guide

Growth

Where do new signups get stuck?

Add setup steps, like connecting an integration or inviting a teammate, to your funnels and see where new accounts stop.

Read the guide

Which accounts are ready to upgrade?

Compare real product usage against the plan limits in your database and flag accounts sitting near or over the line while still on a smaller plan.

Read the guide

Customer success

Which accounts are going quiet?

Measure retention, stickiness, and lifecycle per account, using the account IDs from your database instead of stitching together anonymous users.

Read the guide

Are my most valuable accounts engaged?

Put contract value or seat count from your accounts table next to engagement, and find the large accounts that barely use your product before they come up for renewal.

Read the guide

Use Postgres data across PostHog

Once it's in PostHog, your app data isn't stuck in the SQL editor. You can use it everywhere you already work.

Feature flags

Roll out a feature to accounts on a specific plan, or to everyone who opted into the beta in your app.

Surveys

Ask accounts that signed up in the last two weeks how setup went, or survey only the admins on your largest accounts.

Session replay

Filter recordings to accounts on your top plan, or to accounts that hit a setup error your app logged, and see what happened.

Error tracking

Rank exceptions by the plan or seat count of the accounts hitting them, so the bug that blocks your biggest customers gets fixed first.

Alerts

Watch a number that only your database has, like new orders or active projects per day, and get notified when it drops below its normal range.

Do it once, reuse it everywhere

Build an “enterprise plan, signed up this quarter” cohort once, then reuse the same group as a flag target, a survey audience, and an alert.

Read about cohorts →

Your database has been holding out on you

It knows every account, plan, and signup. Connect Postgres and make it talk.

Spill the tables

Not using PostHog? Sign up