postgresql-best-practices

Guides PostgreSQL and Azure Database for PostgreSQL administration, querying, and optimization tasks.

3|1|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/PALabs-v1/AI_friend --skill postgresql-best-practices-palabs-v1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgresql-best-practices
Source: https://github.com/PALabs-v1/AI_friend/tree/main/.claude/skills/postgresql-best-practices
Command: npx skills add https://github.com/PALabs-v1/AI_friend --skill postgresql-best-practices-palabs-v1

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Working with PostgreSQL—especially Azure Database for PostgreSQL—involves platform-specific constraints (no superuser, no ALTER SYSTEM, allowlisted extensions) that generic advice gets wrong, leading to failed commands, broken auth, and irreversible operations. ## Core Features & Use Cases - Routing to specialized references: Keyword-triggered routing to 20+ reference guides covering indexing, JSONB, partitioning, RLS, full-text search, replication, connection pooling, and query performance. - Azure-specific guardrails: Enforces managed-service constraints (no ALTER SYSTEM, no file paths, no OS commands) and routes to Azure equivalents like az CLI, parameter APIs, PITR, and Entra ID auth. - Safety policies: Requires confirmation before destructive DDL or destructive az CLI commands, detects Azure flavor (Flexible Server vs HorizonDB), and applies anti-hallucination rules. - Use Case: A developer asks how to add pgvector to an Azure Flexible Server; the skill detects the Azure context, walks through the azure.extensions allowlist append workflow, and runs CREATE EXTENSION vector with the correct binary name. ## Quick Start Ask how to set up row-level security for a multi-tenant PostgreSQL database, or how to configure Entra ID authentication on Azure Database for PostgreSQL.

Frequently Asked Questions about postgresql-best-practices

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

FAQPage Schema
How do I install extensions on Azure Database for PostgreSQL?

Extensions on Azure require a two-step process: first append the extension to the azure.extensions server parameter via az CLI or portal (never overwrite the existing list), then run CREATE EXTENSION as azure_pg_admin. Extensions needing shared_preload_libraries also require a server restart.

How do I set up Entra ID authentication for Azure PostgreSQL?

Entra ID auth requires setting an Entra admin, then running pgaadauth_create_principal for each identity. Tokens must use the scope https://ossrdbms-aad.database.windows.net/.default, and managed identity usernames are the client ID, not the display name.

Does Azure PostgreSQL support ALTER SYSTEM for configuration changes?

No, ALTER SYSTEM is blocked on Azure managed PostgreSQL because superuser is unavailable. Use the control-plane parameter API instead: az postgres flexible-server parameter set for Flexible Server, or parameter groups for HorizonDB.

Why does PgBouncer transaction mode break Entra token authentication?

Transaction mode reassigns backend connections per transaction, but Entra tokens bind to the original connection handshake. Use session pool mode for token-authenticated clients, or route them directly to port 5432 bypassing the pooler.

Can I restore an Azure PostgreSQL server in place with point-in-time restore?

No, PITR always creates a new server with a new hostname; it is not an in-place rollback. After restore you must reconfigure HA, firewall rules, VNet settings, and update application connection strings.

What are the limitations of Burstable tier on Azure PostgreSQL?

Burstable tier lacks provisioned IOPS, DiskANN vector indexes, and high availability. In-place tier changes between Burstable, General Purpose, and Memory Optimized are supported with a restart, but plan for these feature gaps before choosing Burstable.