Skip to main content
Connect your PostgreSQL databases to enable Tony (Database Engineer) to analyze queries, optimize performance, and monitor database health.

Supported platforms

Prerequisites

  • A PostgreSQL instance reachable from CloudThinker over the network.
  • Admin access to create a dedicated user and grant privileges.
  • The pg_stat_statements extension installed if you want query-level analysis (required for slow-query data).

Setup

1

Connect as admin

Connect to your PostgreSQL instance using an admin account:
2

Create a read-only user

Create a dedicated user for CloudThinker:
3

Grant connection and schema access

Allow connection and schema usage:
4

Grant SELECT permissions

Grant SELECT on all tables and views, including future ones:
5

Enable pg_stat_statements

This extension is required for query analysis:
For RDS/Aurora, add to your parameter group:
6

Configure network access

Ensure CloudThinker can reach your database:
  • Add CloudThinker IPs to your security group or firewall
  • For RDS: enable public access or use VPC peering
7

Add the connection in CloudThinker

Navigate to Connections → PostgreSQL and enter:
  • Host: your database hostname or IP
  • Port: database port (default: 5432)
  • Database: database name
  • Username: cloudthinker_readonly
  • Password: the password you set above
  • SSL mode: require (recommended)
Click Connect. CloudThinker shows a Connected status once it succeeds.

Connection details

Connection string format:

Required permissions

Minimum

Start with the minimum grants and add the recommended stats grants to unlock query-level analysis and cache hit reporting.

Agent capabilities

Once connected, Tony can:

Verify the connection

Example prompts

Troubleshooting

  • Verify host and port are correct
  • Check your security group or firewall allows CloudThinker IPs
  • For RDS: ensure “Publicly accessible” is enabled or use VPC peering
  • Confirm PostgreSQL is listening on the correct interface
  • Verify username and password are correct
  • Check pg_hba.conf allows the connection method
  • Ensure the user has CONNECT privilege on the database
  • Verify the extension is installed: SELECT * FROM pg_extension WHERE extname = 'pg_stat_statements';
  • Check shared_preload_libraries includes pg_stat_statements
  • Restart PostgreSQL after changing shared_preload_libraries
  • For RDS: modify the parameter group and reboot the instance
  • Verify the user has SELECT on the required tables
  • Grant pg_read_all_stats role for PostgreSQL 14+
  • Check schema permissions with \dn+ in psql

Security

  • Least privilege — grant only the permissions the agents need for your use case; start read-only and widen later.
  • Read-only by default — use read-only credentials unless you want agents to make changes through this connection.
  • Rotate credentials — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
  • Revoke on offboarding — remove the credential at the provider when you delete a connection or a teammate leaves.
  • SSL required — always use SSL mode require or higher to encrypt data in transit.
  • Minimal grants — grant only SELECT to the CloudThinker user; never grant write access.

Tony Agent

Database-focused optimization agent

MySQL Connection

Similar setup for MySQL databases