> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Connecting to the warehouse **The warehouse is in beta** Need access first? [Join the waitlist](/context-warehouse/warehouse.md), then [set up your warehouse](/docs/data-warehouse/warehouse/setup.md). The warehouse speaks the PostgreSQL wire protocol, so you connect with the same clients, drivers, and BI tools you'd point at any Postgres database. No PostHog-specific SDK involved. ## Connection details Your connection details live in [Data ops](https://app.posthog.com/data-ops) under the **Settings** tab once the warehouse is ready: | Field | Value | | --- | --- | | Host | `.dw.us.postwh.com` (US) or `.dw.eu.postwh.com` (EU) | | Port | `5432` | | Database | `ducklake` – always, regardless of warehouse name | | Username | `root` | | Password | Shown once at provisioning; reset it from the Settings tab if lost | TLS is required, so include `sslmode=require`. A complete `psql` connection looks like: Terminal ```bash psql "host=my-warehouse.dw.us.postwh.com port=5432 dbname=ducklake user=root sslmode=require" ``` The same details work in anything that talks Postgres: pgAdmin, DBeaver, Metabase, Grafana, Superset, Tableau, and the standard drivers (psycopg, pgx, JDBC, node-postgres, SQLAlchemy, and friends). ## Find your way around Your first stop after connecting should be discovering what's there: SQL [Run in PostHog](https://us.posthog.com/sql?open_query=--+List+schemas+and+tables%0A%5Cdn%0A%5Cdt%0A%0A--+DuckDB's+DESCRIBE+and+SUMMARIZE+work+too%0ADESCRIBE+events_prod%3B%0ASUMMARIZE+persons_prod%3B) ```sql -- List schemas and tables \dn \dt -- DuckDB's DESCRIBE and SUMMARIZE work too DESCRIBE events_prod; SUMMARIZE persons_prod; ``` With a project schema named `prod`, the layout looks like: SQL [Run in PostHog](https://us.posthog.com/sql?open_query=--+Your+PostHog+events+and+persons%0ASELECT+count%28*%29+FROM+events_prod%3B%0A%0A--+Imported+source+tables+live+in+a+per-project+imports+schema%0ASELECT+*+FROM+posthog_data_imports_prod.stripe_charge+LIMIT+10%3B) ```sql -- Your PostHog events and persons SELECT count(*) FROM events_prod; -- Imported source tables live in a per-project imports schema SELECT * FROM posthog_data_imports_prod.stripe_charge LIMIT 10; ``` ## What SQL works Standard PostgreSQL queries work as-is: `SELECT`, joins, CTEs, window functions, prepared statements, transactions, and `COPY ... TO STDOUT` for bulk export (including `\copy` in `psql`). Because the engine is DuckDB, its analytical SQL passes through transparently as well – `DESCRIBE`, `SUMMARIZE`, `QUALIFY`, `SELECT * EXCLUDE (...)`, `FROM`\-first queries, and `ASOF` joins all work. You get DuckDB's full function library on top of the Postgres compatibility layer. You can also write: `CREATE TABLE`, `CREATE VIEW`, `INSERT`, `UPDATE`, and `DELETE` are supported, so the warehouse can hold your own derived tables next to the synced data. Keep your own work in tables or schemas you create – the PostHog-managed tables are maintained by sync, and anything you write into them can be overwritten. A few things a Postgres veteran will notice are absent: server-side functions and triggers (PL/pgSQL), sequences, and `LISTEN`/`NOTIFY` don't exist in DuckDB, and credentials are managed by PostHog rather than through `CREATE ROLE`. ## Querying from PostHog You don't need an external client to use the warehouse. Once provisioned, it's available in PostHog's [SQL editor](/docs/data-warehouse/query.md) alongside your other sources, and PostHog's AI features can use it as context. External connections are for everything else – dashboards in your BI tool, notebooks, scheduled jobs, or ad-hoc `psql` sessions. For larger or latency-sensitive workloads, [tune the worker's CPU, memory, and idle lifetime](/docs/data-warehouse/warehouse/performance-tuning.md). ### Still have questions? Ask PostHog AI ### Was this page useful? HelpfulCould be better