cloud-sql-postgres-replication

Monitor Cloud SQL for PostgreSQL replication lag and role permissions.

42|7|Updated Sep 12, 2025
One-click install
npx skills add https://github.com/gemini-cli-extensions/cloud-sql-postgresql --skill cloud-sql-postgres-replication
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloud-sql-postgres-replication
Source: https://github.com/gemini-cli-extensions/cloud-sql-postgresql/tree/main/skills/cloud-sql-postgres-replication
Command: npx skills add https://github.com/gemini-cli-extensions/cloud-sql-postgresql --skill cloud-sql-postgres-replication

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Manually tracking Cloud SQL for PostgreSQL replication lag, managing replication slots, and auditing database role permissions is time-consuming and prone to oversight, especially for teams managing multiple database instances.

Core Features & Use Cases

  • Replication Health Monitoring: Pull real-time lag metrics for all replicas, including sent, write, flush, and replay lag, to quickly identify sync bottlenecks.
  • Replication Slot Management: View all replication slots and their outstanding WAL sizes to prevent unnecessary storage consumption from unused slots.
  • Role & Security Auditing: List all database roles with their permission attributes, connection limits, and membership details to ensure compliance with security policies.
  • Use Case: If you are troubleshooting a read replica that is falling behind the primary, use this skill to pull replication stats and identify if the lag is caused by network latency or long-running queries on the replica.

Quick Start

Ask your AI agent to pull the current replication lag metrics for all PostgreSQL replicas in your Cloud SQL instance and list any roles with superuser privileges.

Frequently Asked Questions about cloud-sql-postgres-replication

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I monitor Cloud SQL for PostgreSQL replication lag?

To monitor Cloud SQL PostgreSQL replication lag, retrieve real-time metrics for sent, write, flush, and replay lag across all replicas to quickly identify sync bottlenecks. This allows you to pinpoint whether network latency or long-running queries are causing the delay.

What is the best way to check PostgreSQL replication slot WAL sizes in Cloud SQL?

Checking PostgreSQL replication slot WAL sizes in Cloud SQL involves viewing all replication slots and their outstanding WAL data. This prevents unnecessary storage consumption by identifying and cleaning up unused or stalled replication slots.

How do I audit database role permissions and superuser privileges in Cloud SQL PostgreSQL?

Auditing database role permissions in Cloud SQL PostgreSQL requires listing all roles alongside their security attributes, connection limits, and membership details. This ensures compliance with security policies by easily identifying any roles holding superuser privileges.

Why does my Cloud SQL PostgreSQL read replica keep falling behind the primary?

A Cloud SQL PostgreSQL read replica falling behind the primary often stems from network latency or long-running queries on the replica. Pulling current replication stats and WAL slot status helps diagnose the exact bottleneck causing the sync delay.

Can I manage multiple Cloud SQL PostgreSQL instances with this replication monitoring approach?

Yes, managing multiple Cloud SQL PostgreSQL instances is supported through streamlined database administration workflows. It retrieves real-time replication metrics, WAL slot status, and role attribute data via prebuilt Cloud SQL tooling to reduce manual oversight.