Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. PostgreSQL
  3. pg_shard

pg_shard

LGPL-3.0Cv1.2.3

A PostgreSQL extension for distributing and sharding tables across multiple servers to scale write performance.

Visit WebsiteGitHubGitHub
1.1k stars62 forks0 contributors

What is pg_shard?

pg_shard is a PostgreSQL extension that enables horizontal scaling by distributing and sharding tables across multiple database servers. It allows applications to handle higher write loads by partitioning data while maintaining SQL compatibility with standard PostgreSQL syntax.

Target Audience

Database administrators and backend developers managing PostgreSQL databases that require horizontal scaling to handle increased write loads and large datasets.

Value Proposition

Developers choose pg_shard for its seamless integration with PostgreSQL, maintaining SQL compatibility and extensibility while providing automatic sharding and parallel query execution across distributed servers.

Overview

ATTENTION: pg_shard is superseded by Citus, its more powerful replacement

Use Cases

Best For

  • Scaling PostgreSQL databases horizontally to manage high write loads.
  • Distributing large tables across multiple database servers using consistent hashing.
  • Executing queries in parallel across shards for improved performance.
  • Maintaining SQL compatibility while sharding data in existing PostgreSQL applications.
  • Implementing fault-tolerant data distribution with support for node failures and replication.
  • Using hash-based or range-based sharding strategies for data partitioning.

Not Ideal For

  • Applications requiring complex joins or aggregates across the entire sharded dataset, as network latency can degrade performance.
  • Systems that depend on strict ACID transactions spanning multiple shards, due to limitations in distributed transaction support.
  • Small to medium databases where vertical scaling or simpler partitioning methods suffice, avoiding unnecessary operational overhead.
  • Projects with limited database administration expertise, as managing a sharded cluster requires significant setup and maintenance efforts.

Pros & Cons

Pros

Automatic Sharding

Implements consistent hashing to distribute table rows across multiple PostgreSQL servers, enabling seamless horizontal scaling for high write loads as highlighted in the key features.

Parallel Query Execution

Executes queries concurrently on different shards, improving performance for distributed data access, which is a core feature for handling large datasets.

SQL Compatibility

Maintains standard PostgreSQL syntax, allowing existing applications to leverage sharding with minimal code changes, as emphasized in the value proposition.

Flexible Data Distribution

Supports both hash-based and range-based sharding strategies, providing options to optimize for different query patterns and data access needs.

Fault Tolerance Mechanisms

Includes handling of node failures and data replication, enhancing reliability in distributed setups, as noted in the key features for robustness.

Cons

Operational Complexity

Requires configuring and managing multiple PostgreSQL servers, which can be operationally intensive and error-prone for teams without distributed systems expertise.

Cross-Shard Query Limitations

Queries involving joins or aggregates across shards can suffer from performance degradation due to network overhead and data movement challenges.

Ecosystem and Support Gaps

As a niche extension, it may have fewer community resources, documentation, or integrations compared to more mainstream PostgreSQL scaling solutions.

Frequently Asked Questions

Quick Stats

Stars1,063
Forks62
Contributors0
Open Issues38
Last commit9 years ago
CreatedSince 2014

Tags

#horizontal-scaling#fault-tolerance#postgresql-extension#consistent-hashing#database-sharding#distributed-database

Built With

P
PostgreSQL
C
C++

Links & Resources

Website

Included in

PostgreSQL11.8k
Auto-fetched 1 day ago

Related Projects

CitusCitus

Distributed PostgreSQL as an extension

Stars12,455
Forks767
Last commit2 days ago
ZomboDBZomboDB

Making Postgres and Elasticsearch work together like it's 2023

Stars4,735
Forks214
Last commit1 year ago
AGEAGE

Graph database optimized for fast analysis and real-time data processing. It is provided as an extension to PostgreSQL.

Stars4,468
Forks488
Last commit2 days ago
pg_cronpg_cron

Run periodic jobs in PostgreSQL

Stars3,768
Forks246
Last commit11 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub