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.getcloudsql.databases.updatecloudsql.instances.getcloudsql.instances.listcloudsql.instances.updatemonitoring.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_memrandom_page_costseq_page_costcheckpoint_completion_targeteffective_io_concurrencymax_parallel_workers_per_gathermax_parallel_workersmax_wal_sizemin_wal_sizebgwriter_lru_maxpagesbgwriter_delaymaintenance_work_memdefault_statistics_targetmax_parallel_maintenance_workers
Restart tuning mode
The following parameters are tuned in restart mode, in addition to all reload-only parameters:
shared_buffersmax_worker_processeswal_buffers