Federation
HostQuery
Register remote Postgres, MySQL, and other hosts once, then query them — and join across them — from a single DuckDB session.
Overview
What HostQuery does
HostQuery is a federation worker. Register a set of remote database hosts with the worker and each becomes an attachable schema. DuckDB can then read from them, push down filters and projections, and join results across hosts that could never talk to each other directly.
The worker handles connection pooling, credential storage, and dialect translation, so a single SQL query can span a production Postgres replica, an analytics MySQL box, and a local Parquet file at once — without an ETL hop in between.
Highlights
- Register many remote hosts as one catalog
- Predicate and projection push-down per host
- Cross-host joins from a single session
- Connection pooling and credential isolation
- Postgres, MySQL, and ODBC-speaking hosts
Attach & query
-- Attach the HostQuery federation worker
ATTACH 'hosts' AS hq (
TYPE vgi,
LOCATION 'https://orchard.query.farm/hostquery',
TOKEN getenv('ORCHARD_TOKEN')
);
-- Join a Postgres replica against an analytics MySQL host
SELECT o.id, o.total, c.segment
FROM hq.pg_prod.orders AS o
JOIN hq.mysql_analytics.customers AS c USING (customer_id)
WHERE o.created_at > now() - INTERVAL 1 DAY;
Requires the VGI extension. Set ORCHARD_TOKEN after subscribing.
What you get
Tables & functions it exposes
Once attached, the connector adds these objects to your SQL session.
hostquery.hosts Registered hosts and their reachability.
remote(host, sql) Run a statement on a specific host and stream rows.
h(host, table) Shorthand to reference a remote host’s table.
host_credentials Per-host connection secrets.
Use cases
What teams build with HostQuery
Join a production replica with an analytics database live.
Query many regional shards as if they were one table.
Pull a reference table from another team without exporting it.
Keep exploring
Other connectors
Kafka
Streaming
Read and produce Kafka topics as SQL tables.
IMAP
Query mailboxes and messages over IMAP as tables.
Row / Column Level Security
Governance
Policy-based row filtering and column masking for any catalog.
Ready to attach HostQuery?
Subscribe in minutes, or talk to us about a custom connector for your stack.