Skip to content

PostgreSQL

Connect Querri to your PostgreSQL database to analyze data using natural language. Once connected, simply ask questions—Querri handles all the SQL for you.

The PostgreSQL connector supports:

  • PostgreSQL 9.6+: All modern PostgreSQL versions
  • AWS RDS PostgreSQL: Managed PostgreSQL on AWS
  • Azure Database for PostgreSQL: Managed PostgreSQL on Azure
  • Google Cloud SQL for PostgreSQL: Managed PostgreSQL on GCP
  • Heroku Postgres: Heroku’s managed PostgreSQL
  • PostgreSQL database server
  • Database credentials with appropriate permissions
  • Network access to the database

Important: For cloud-hosted databases or databases behind firewalls, whitelist the following IP address:

18.189.33.77

This is Querri’s outbound IP address. Add this to your database firewall rules or security group.

  1. Navigate to Connectors

    • Go to Settings → Connectors
    • Click “Add Connector”
  2. Select PostgreSQL

    • Choose “PostgreSQL” from the database connectors
  3. Configure Connection

Host: your-database-host.com
Port: 5432 (default PostgreSQL port)
Database: your_database_name
Username: your_username
Password: your_password

Optional Settings:

  • SSL Mode:
    • require - Always use SSL (recommended)
    • prefer - Use SSL if available
    • disable - Don’t use SSL
  • Schema: Default is public
  • Connection Timeout: Default is 30 seconds
  1. Test Connection

    • Click “Test Connection” to verify
    • If successful, click “Save”
  2. Start Analyzing

    • Tables appear in your Library
    • Create a project from any table
    • Ask questions in natural language

Add inbound rule:

Type: PostgreSQL
Protocol: TCP
Port: 5432
Source: 18.189.33.77/32
Description: Querri Access

Add firewall rule:

Rule Name: Querri
Start IP: 18.189.33.77
End IP: 18.189.33.77

Add authorized network:

Name: Querri
Network: 18.189.33.77/32

Heroku Postgres allows connections from any IP by default. No configuration needed.

Create a dedicated read-only user for Querri:

-- Create user
CREATE USER querri_readonly WITH PASSWORD 'secure_password_here';
-- Grant connect permission
GRANT CONNECT ON DATABASE your_database TO querri_readonly;
-- Grant schema usage
GRANT USAGE ON SCHEMA public TO querri_readonly;
-- Grant select on all tables
GRANT SELECT ON ALL TABLES IN SCHEMA public TO querri_readonly;
-- Grant select on future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT ON TABLES TO querri_readonly;

For tighter security, grant access only to specific tables or views:

-- Grant access to specific tables only
GRANT SELECT ON orders, customers, products TO querri_readonly;
-- Or grant access only to an analytics schema
GRANT USAGE ON SCHEMA analytics TO querri_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA analytics TO querri_readonly;

See Database Best Practices for detailed guidance on creating analytics views and restricting access.

PostgreSQL data can be kept up to date with scheduled syncs. Go to Settings → Connectors, select your PostgreSQL connector, and open the Schedule tab.

A full sync re-reads every table from your PostgreSQL database. Use this as a periodic baseline, especially if your schema changes or if records are deleted.

Incremental sync fetches only rows that have changed since the last sync. Unlike business application connectors (QuickBooks, HubSpot), PostgreSQL requires you to specify which column to use as the cursor.

Good cursor columns:

ColumnBest ForExample
updated_atTables that track modification timeBest choice — catches inserts and updates
created_atAppend-only tablesOnly catches new rows
Sequential idAppend-only tablesOnly catches new rows

Tables that don’t support incremental sync:

  • Tables without a timestamp or sequential column
  • Lookup/reference tables (rarely change)
  • Tables populated by ETL processes that truncate and reload

For these tables, use full sync.

ScheduleTypeCronPurpose
FrequentIncremental0 */2 * * * (every 2 hours)Fresh data for tables with updated_at columns
DailyFull0 4 * * * (daily 4 AM)Catches deletes, schema changes, and tables without cursors

Enable Skip sources with active incremental sync on the full schedule to avoid re-syncing tables that are already covered by the incremental schedule.

See the Sync Scheduling guide for full setup instructions.

Problem: Cannot connect to database

Solutions:

  1. Verify IP 18.189.33.77 is whitelisted
  2. Check database host and port are correct
  3. Verify database is running and accessible
  4. Check SSL mode settings
  5. Verify network connectivity

Problem: Invalid credentials error

Solutions:

  1. Double-check username and password
  2. Verify user exists: SELECT * FROM pg_user WHERE usename = 'your_username';
  3. Check user has connect permission
  4. Verify database name is correct

Problem: Permission denied on table/schema

Solutions:

  1. Grant necessary permissions (see Database User Setup)
  2. Verify schema name is correct
  3. Check table ownership
  4. Run: \dp table_name to see table permissions

Problem: SSL connection failed

Solutions:

  1. Try different SSL modes (prefer, require, disable)
  2. Verify server SSL certificate is valid
  3. Check PostgreSQL SSL configuration
  4. For RDS, ensure SSL is enabled

Create dedicated read-only users for analytics:

  • Prevents accidental data modification
  • Limits potential security impact
  • Easier to audit and monitor

Always use SSL for production databases:

SSL Mode: require

Grant only necessary permissions:

-- Only SELECT on specific tables
GRANT SELECT ON TABLE orders, customers TO querri_readonly;
-- Only specific columns (if needed)
GRANT SELECT (customer_id, email, created_at) ON customers TO querri_readonly;

Monitor database access:

-- View active connections
SELECT * FROM pg_stat_activity
WHERE usename = 'querri_readonly';

Tested and supported versions:

  • PostgreSQL 16.x ✓
  • PostgreSQL 15.x ✓
  • PostgreSQL 14.x ✓
  • PostgreSQL 13.x ✓
  • PostgreSQL 12.x ✓
  • PostgreSQL 11.x ✓ (limited support)
  • PostgreSQL 10.x ✓ (limited support)
  • PostgreSQL 9.6.x ✓ (limited support)