PostgreSQL
Connect to any PostgreSQL database — self-hosted, AWS RDS, Supabase, Neon, or any Postgres-compatible service.
Configuration
| Field | Required | Description |
|---|---|---|
host | Yes | Database host (e.g., localhost, db.example.com) |
port | Yes | Port number (default: 5432) |
database | Yes | Database name |
user | Yes | Database user |
password | Yes | Database password |
ssl_mode | No | SSL mode: disable, allow, prefer (default), require. Use require for cloud-hosted databases. |
Query Mode
PostgreSQL supports both Sync and Live mode. Choose during connection setup:
- Sync - Copies data to the Iceberg lakehouse. Fast local queries, historical data.
- Live - Queries your Postgres directly via DuckDB's
postgres_scanner. Always fresh, no sync delay.
See Live Mode for trade-offs and details.
Synced Tables
In sync mode, we sync all tables in the public schema by default. Tables are synced with their original names:
-- If your Postgres has tables: users, orders, products-- And you name the connection "mydb"
SELECT * FROM mydb.users;SELECT * FROM mydb.orders;SELECT * FROM mydb.products;-- If your Postgres has tables: users, orders, products-- And you name the connection "mydb"
SELECT * FROM mydb.users;SELECT * FROM mydb.orders;SELECT * FROM mydb.products;Network Access
Your database must be accessible from our servers. Options:
- Public IP - Whitelist our IPs (email hello@rawquery.dev for the list)
- SSH tunnel - Email hello@rawquery.dev for setup
- VPN/VPC peering - Enterprise plan
Supabase
Supabase uses connection pooling. Use the Session Mode connection string from your Supabase dashboard (Settings → Database → Connection string).
rq connections create my-supabase --type postgres \ -p host=aws-0-us-east-1.pooler.supabase.com \ -p port=5432 \ -p database=postgres \ -p user=postgres.your_project_ref \ -p password=your_db_password \ -p ssl_mode=requirerq connections create my-supabase --type postgres \ -p host=aws-0-us-east-1.pooler.supabase.com \ -p port=5432 \ -p database=postgres \ -p user=postgres.your_project_ref \ -p password=your_db_password \ -p ssl_mode=requireThe user format is postgres.your_project_ref (not just postgres). You'll find your project ref in the Supabase dashboard URL or in Settings → General.
Neon, RDS, Cloud SQL
Any managed Postgres works the same way. Use the host, port, user, and password from your provider's dashboard, and set ssl_mode=require.
Recommended Setup
For self-hosted Postgres, create a read-only user:
CREATE USER rawquery WITH PASSWORD 'secure_password';
GRANT CONNECT ON DATABASE mydb TO rawquery;GRANT USAGE ON SCHEMA public TO rawquery;GRANT SELECT ON ALL TABLES IN SCHEMA public TO rawquery;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO rawquery;CREATE USER rawquery WITH PASSWORD 'secure_password';
GRANT CONNECT ON DATABASE mydb TO rawquery;GRANT USAGE ON SCHEMA public TO rawquery;GRANT SELECT ON ALL TABLES IN SCHEMA public TO rawquery;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO rawquery;