GCP - Google Cloud SQL for PostgreSQL
Google Cloud Platform CloudSQL for PostgreSQL agent setup
For an overview of how the DBtune agent works, see agent overview.
Prerequisites
Before starting the DBtune agent, ensure you have completed the database setup steps.
Google Cloud Platform IAM permissions
The agent is setup to use the application default credentials. The credentials provided to the agent need at least the following permissions:
cloudsql.databases.get
cloudsql.databases.update
cloudsql.instances.get
cloudsql.instances.list
cloudsql.instances.update
monitoring.timeSeries.list
Setting up the agent
Run the DBtune agent using Docker with Cloud SQL-specific configuration:
docker run --restart always --detach \
-e DBT_POSTGRESQL_CONNECTION_URL="postgresql://..." \
-e DBT_GCP_PROJECT_ID={gcp_project_id} \
-e DBT_GCP_DATABSE_NAME={gcp_cloudsql_database_name} \
-e DBT_DBTUNE_SERVER_URL=https://app.dbtune.com \
-e DBT_DBTUNE_API_KEY=your-dbtune-api-key \
-e DBT_DBTUNE_DATABASE_ID=your-dbtune-database-id \
public.ecr.aws/dbtune/dbtune/agent:latest --cloudsql
For information about common environment variables (DBT_DBTUNE_* and DBT_POSTGRESQL_*), see agent overview - common environment variables.
Google Cloud Platform SQL-specific environment variables
Variable | Description |
---|---|
DBT_GCP_PROJECT_ID | Identifier of the Google Cloud Platform project where the database is located. |
DBT_GCP_DATABSE_NAME | Name of the Cloud SQL database instance. |
Parameters tuned
DBtune supports multiple tuning modes that determine which parameters can be optimized. For a detailed explanation of tuning modes, see tuning modes.
Reload-only tuning mode
The following parameters are tuned in reload-only mode:
work_mem
random_page_cost
seq_page_cost
checkpoint_completion_target
effective_io_concurrency
max_parallel_workers_per_gather
max_parallel_workers
max_wal_size
min_wal_size
bgwriter_lru_maxpages
bgwriter_delay
maintenance_work_mem
default_statistics_target
max_parallel_maintenance_workers
Restart tuning mode
The following parameters are tuned in restart mode, in addition to all reload-only parameters:
shared_buffers
max_worker_processes
wal_buffers