When to Use Multiple Clusters, Databases, or Schemas?

April 23, 2012

I previously explained that Postgres allows multiple databases per cluster. The outstanding question might be, when should I use multiple clusters, multiple databases, or multiple schemas? The following table outlines the advantages of the various container types:
 

Feature Cluster Database Schema
Isolated Server Start/Stop      ✓    
Connection Control      ✓      ✓  
Private System Tables      ✓      ✓ &nnbsp;
Private Plug-Ins      ✓      ✓  
Isolated Administration      ✓    
Shared Administration        ✓      ✓
Isolated Resource Usage      ✓    
Shared Resource Usage(1)        ✓      ✓
Data Isolation(2)      ✓      ✓  
Cross-Container Queries          ✓


(1) A large number of data containers increases the usefulness of resource sharing, e.g. shared_buffers. Resource sharing includes log shipping and streaming replication sharing.

(2) User and database names, being global objects, are visible in all databases. It is impossible to query across databases, except via an external database session, e.g. dblink. Schema permissions allow data access control, but pg_class still shows all tables defined in the database.

Hopefully this chart helps users choose the proper container for their data needs.

Enterprise-ready Postgres tools for high availability, monitoring, and disaster recovery. Download Now.

Share this

Relevant Blogs

What is pgvector and How Can It Help You?

With pgvector extension, you don’t need a specialized vector database, you can just use Postgres! Using pgvector you can now store vectors (embeddings), query them, use special index types to...
November 03, 2023

PostgreSQL 16 Update: Grouping Digits in SQL

One of the exciting new features in PostgreSQL 16 is the ability to group digits in numeric literals by separating them with underscores. This blog post covers the details.
October 17, 2023

More Blogs

pgAdmin CI/CD

Almost exactly three years ago I wrote a blog on my personal page entitled Testing pgAdmin which went into great detail discussing how we test pgAdmin prior to releases. Back...
August 24, 2023