From 036cd0a48050718449d29a79b93a3f8681334223 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Tue, 5 May 2026 17:22:02 -0700 Subject: [PATCH] feat(postgres): enable Enterprise Plus, index advisor, and deadlock tuning Upgrade Cloud SQL instance to Enterprise Plus edition with index advisor enabled and deadlock detection timeout reduced to 1 second. Co-Authored-By: Claude Opus 4.6 --- examples/standalone-infra/postgres.tf | 11 +++++++++++ examples/standalone-infra/variables.tf | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/standalone-infra/postgres.tf b/examples/standalone-infra/postgres.tf index fa96fc1..900587d 100644 --- a/examples/standalone-infra/postgres.tf +++ b/examples/standalone-infra/postgres.tf @@ -10,6 +10,7 @@ resource "google_sql_database_instance" "main" { settings { tier = var.postgres_tier + edition = "ENTERPRISE_PLUS" disk_size = var.postgres_disk_size_gb disk_autoresize = true @@ -25,6 +26,16 @@ resource "google_sql_database_instance" "main" { enabled = true start_time = "03:00" } + + database_flags { + name = "cloudsql.enable_index_advisor" + value = "on" + } + + database_flags { + name = "deadlock_timeout" + value = "1000" + } } deletion_protection = false diff --git a/examples/standalone-infra/variables.tf b/examples/standalone-infra/variables.tf index 52ca004..1dc2af6 100644 --- a/examples/standalone-infra/variables.tf +++ b/examples/standalone-infra/variables.tf @@ -16,9 +16,9 @@ variable "name" { } variable "postgres_tier" { - description = "Cloud SQL machine tier (db-custom-VCPU-RAM_MB)" + description = "Cloud SQL machine tier (Enterprise Plus requires db-perf-optimized-N-*)" type = string - default = "db-custom-1-3840" + default = "db-perf-optimized-N-2" } variable "postgres_disk_size_gb" {