Browse by type
As of October 8, 2026, PostHog is no longer developing duckgres.
This repository will receive no new features, and issues and pull requests will not be reviewed. The code remains available under the MIT license for anyone who wants to read, fork or build on it.
Thank you to everyone who used duckgres, filed issues and contributed along the way.
[!WARNING] Deprecated: the Duckgres management plane has been replaced by hogtower. The provisioning/admin API and the admin console are deprecated and will be removed. Use hogtower to manage warehouses. PostgreSQL wire protocol (pgwire) and DuckDB query serving are unaffected.
Trino operators: see cell registration and placement for the shared-pool registry, initial placement, and retirement prerequisites.
DUCKGRES_TRINO_POOL_NODE_DISRUPTION_ENABLED defaults to false. Enabled shared-pool
operators protect owned pods and replace instances on drifted or deleting Karpenter
nodes through normal admission and drain. See the node replacement runbook
for required permissions, rollout order, and failure boundaries.

A PostgreSQL wire protocol compatible server backed by DuckDB. Connect with any PostgreSQL client (psql, pgAdmin, lib/pq, psycopg2, etc.) and get DuckDB's analytical query performance.
COPY FROM STDIN and COPY TO STDOUTFor automatic initial placement, configure DUCKGRES_TRINO_DEFAULT_CELL
(default unset).
Existing Trino clients retain their DuckLake backend. New Trino clients use
Hoglake automatically; there is no backend chooser or DuckLake fallback for new
onboarding. Hoglake requires DUCKGRES_TRINO_MANAGED_HOGLAKE_URI and a dedicated
DUCKGRES_TRINO_HOGLAKE_DATA_PATH; the namespace defaults to main.
DUCKGRES_TRINO_HOGLAKE_FILESYSTEM_CACHE_ENABLED (default false) enables the
Trino filesystem cache for new Hoglake catalogs only. New DuckLake catalogs follow
DUCKGRES_TRINO_FILESYSTEM_CACHE_ENABLED (default false).
Disable/re-enable preserves the stored backend. This creates a separate catalog
and does not migrate DuckLake data. Manual migration is outside this rollout.
See the managed Hoglake provisioning runbook.
All configured Trino cells use the shared compute pool. The console requires
an explicit cell selection. Stored ownership uses registered:<cell-id> and
is not changed by compute replacement. Duckgres publishes catalogs directly to
the shared catalog store and admits tenants only after the serving instances
acknowledge their catalog and authorization revisions.
See cell registration and the
node replacement runbook.
Trino SHOW CREATE TABLE and SHOW CREATE VIEW use the same catalog, schema,
and relation read grants as table reads. Project-scoped logins can inspect only
relations their scope permits; this does not grant access to the system catalog.
Run just test-trino-opa to check the authorization policy locally.
Duckgres exposes Prometheus metrics on :9090/metrics. The metrics port is currently fixed at 9090 and cannot be changed via configuration.
See docs/metrics.md for exact request-path boundaries, labels, aggregation rules, PromQL examples, and admission metric migration.
| Metric | Type | Description |
|---|---|---|
duckgres_connections_open |
Gauge | Process-wide number of currently open client connections, including native metadata-proxy sockets |
duckgres_connection_duration_seconds{org} |
Histogram | Worker-backed Duckgres connection lifetime, accept→disconnect (includes _count, _sum, _bucket); excludes native metadata-proxy connections, which use their dedicated duration family |
duckgres_metadata_proxy_connections_open{org} |
Gauge | Current admitted native metadata Postgres proxy connections; process-local, so sum across control-plane replicas |
duckgres_metadata_proxy_connection_attempts_total{org,outcome} |
Counter | Metadata proxy attempts by bounded terminal outcome |
duckgres_metadata_proxy_connection_duration_seconds{org} |
Histogram | Lifetime of admitted metadata proxy connections, including upstream bootstrap |
duckgres_metadata_proxy_upstream_connect_duration_seconds{org,outcome} |
Histogram | Internal metadata Postgres connect/auth latency; outcome is success or error |
duckgres_metadata_proxy_bytes_total{org,direction} |
Counter | Post-authentication pgwire bytes relayed in client_to_upstream or upstream_to_client direction |
duckgres_metadata_proxy_cancel_requests_total{outcome} |
Counter | Raw metadata-proxy CancelRequests handled as session_terminated on the owning control-plane replica or not_local on another replica |
duckgres_query_total{org,status,reason} |
Counter | Total non-empty query attempts. Valid status/reason pairs: success/none; failure/user, failure/canceled, failure/conflict; error/metadata_connection_lost, error/system. |
duckgres_query_duration_seconds{org} |
Histogram | Simple/extended query execution latency (includes _count, _sum, _bucket); use duckgres_query_total for attempt totals |
duckgres_auth_failures_total |
Counter | Process-wide authentication failures, including wrong-password metadata-proxy attempts; use duckgres_metadata_proxy_connection_attempts_total{outcome="auth_failed"} for the proxy-specific split |
duckgres_rate_limit_rejects_total |
Counter | Process-wide pre-TLS connection rejections due to rate limiting; these cannot be attributed to the worker or metadata endpoint because SNI is not available yet |
duckgres_rate_limited_ips |
Gauge | Number of currently rate-limited IP addresses |
duckgres_control_plane_workers_active |
Gauge | Number of active control-plane worker processes |
duckgres_control_plane_worker_acquire_seconds |
Histogram | Time spent acquiring a worker for a new session |
duckgres_control_plane_worker_queue_depth |
Gauge | Approximate number of session requests waiting on worker acquisition |
duckgres_control_plane_worker_spawn_seconds |
Histogram | Time spent spawning and health-checking a new worker |
duckgres_session_admission_evaluation_duration_seconds{decision,reason} |
Histogram | Latency of one DB-backed admission poll for the polling request |
duckgres_session_admission_evaluations_total{decision,reason} |
Counter | Admission request polls; repeated polls are distinct evaluations |
duckgres_session_admission_wait_seconds{org,outcome,reason} |
Histogram | End-to-end wait for one successfully enqueued admission request |
duckgres_session_admission_requests_total{org,outcome,reason} |
Counter | Exactly one terminal event per successfully enqueued admission request |
duckgres_session_admission_queue_depth{org} |
Gauge | Local callers waiting after successful durable enqueue; sum across replicas |
duckgres_session_admission_active_vcpus{org} |
Gauge | Requested vCPUs held by local live lease handles; cleanup-pending durable rows are excluded |
duckgres_session_admission_limit_vcpus{org} |
Gauge | Config-reconciled effective org cap for active org stacks; zero means unlimited, max across replicas |
duckgres_session_admission_reclaim_pending |
Gauge | Activated cleanup intents awaiting or executing exact database reclamation |
duckgres_session_admission_reclaim_attempts_total{outcome} |
Counter | Exact cleanup attempts by success or error outcome |
duckgres_session_admission_reclaim_reservations_in_use |
Gauge | Cleanup-ownership slots held before enqueue, while queued or live, and during pending cleanup |
duckgres_session_admission_reclaim_reservation_capacity |
Gauge | Cleanup-ownership slot capacity for this control-plane process (4096 per reclaimer by default) |
duckgres_session_admission_reclaim_reservation_rejections_total{reason} |
Counter | Reservations rejected because capacity was full, the reclaimer was closed, or the exact reference was a duplicate |
duckgres_session_start_duration_seconds{org,protocol,outcome} |
Histogram | Authenticated PostgreSQL session bootstrap through flushed ReadyForQuery |
duckgres_postgres_session_start_total{org,outcome,reason} |
Counter | Exactly one terminal result per authenticated PostgreSQL session start after server retries; outcome is success\|failure and bounded reasons distinguish operator-actionable failures from client/lifecycle noise |
scripts/test_metrics.sh - Runs a quick sanity check (starts server, runs queries, verifies counts)scripts/load_generator.sh - Generates continuous query load until Ctrl-Cscripts/perf_smoke.sh - Runs the golden-query perf harness and writes artifacts to artifacts/perf/<run_id>scripts/perf_nightly.sh - Nightly wrapper with lock/timeout guards and optional artifact publishermetrics-compose.yml - Starts Prometheus and Grafana locally for metrics (Prometheus at http://localhost:9091, Grafana at http://localhost:3000)When DuckLake uses a Postgres metadata store, Duckgres writes durable per-query
history to the native Postgres table querylog.query_log_entries. The query
log is queryable through ducklake.system.query_log, a live view over that
native Postgres table. The view is not DuckLake snapshot data.
Rows record SQL user (user_name), org, query text, duration, row counts,
errors, trace/span IDs, and profiling-derived resource usage. cpu_time_s is
DuckDB cumulative CPU/thread time in seconds, and peak_buffer_memory_bytes is
DuckDB's system_peak_buffer_memory in bytes, not process RSS.
query_id is a per-statement UUIDv7 minted when the query arrives. It is
time-ordered, appears on the statement's OTEL span (duckgres.query_id) and its
error logs, and is the key that correlates every query-log event for one
statement. A batched simple query (SELECT 1; SELECT 2) runs each statement
under its own query_id, with parent_query_id and statement_index
identifying the Query message they arrived in.
Statements produce a pair of events, using ClickHouse's type vocabulary
(QueryStart = 1, QueryFinish = 2, ExceptionBeforeStart = 3,
ExceptionWhileProcessing = 4):
QueryStart is emitted when the statement begins executing.QueryFinish, or ExceptionWhileProcessing if it
failed after execution began, or ExceptionBeforeStart if it failed before
execution began — auth or policy denial, a transpile error, a failure to
obtain a worker, or an extended-protocol Describe whose prepare the engine
rejected. ExceptionBeforeStart events have no QueryStart, by definition.The boundary is execution began, not an engine saw it: Describe hands
the statement to a worker to learn its result schema, so a binder error there
is an ExceptionBeforeStart even though the engine did see the SQL. This is
the same line ClickHouse draws — analysis-time fai
browse all types & interfaces →
$ claude mcp add duckgres \
-- python -m otcore.mcp_server <graph>