Skip to content

Commit 463c7ce

Browse files
committed
shorten readme
1 parent 5d4c65c commit 463c7ce

File tree

1 file changed

+29
-51
lines changed

1 file changed

+29
-51
lines changed

README.md

+29-51
Original file line numberDiff line numberDiff line change
@@ -36,84 +36,54 @@ SELECT * FROM payments WHERE user_id = 1;
3636

3737
## Features
3838

39+
3940
### Load balancer
4041

41-
PgDog is an application layer (OSI Level 7) load balancer for PostgreSQL. It can proxy multiple replicas (and primary) and distribute transactions. It comes with support for multiple strategies, including round robin and random. Additionally, it can parse queries and send `SELECT` queries to replicas and all others to the primary. This allows to proxy all databases behind a single PgDog deployment.
42+
PgDog is an application layer (OSI Level 7) load balancer for PostgreSQL. It can proxy multiple replicas (and primary) and distribute transactions evenly between databases. It supports multiple strategies, including round robin, random, least active connections, etc. PgDog can also inspect queries and send `SELECT` queries to replicas, and all others to the primary. This allows to proxy all databases behind a single PgDog deployment.
4243

4344
📘 **[Load balancer](https://docs.pgdog.dev/features/load-balancer)**
4445

4546
#### Healthchecks and failover
4647

47-
PgDog maintains a real time list of healthy hosts in its database configuration.
48-
When a host fails a healthcheck, it's removed from active rotation
49-
and queries are rerouted to other replicas. This is analogous to modern HTTP
50-
load balancing, except it's at the database layer.
48+
PgDog maintains a real-time list of healthy hosts. When a host fails a healthcheck, it's removed from active rotation and queries are rerouted to other databases. This is similar to HTTP load balancing, except it's at the database layer.
5149

52-
Failover maximizes database availability and protects against intermittent issues like spotty network connectivity and temporary downtime.
50+
Failover maximizes database availability and protects against bad network connections, temporary hardware failures or misconfiguration.
5351

5452
📘 **[Healthchecks](https://docs.pgdog.dev/features/healthchecks)**
5553

5654
### Transaction pooling
5755

58-
Like pgbouncer, PgDog supports transaction-level connection pooling, allowing
59-
1000s (even 100,000s) of clients to reuse just a few PostgreSQL server connections.
56+
Like PgBouncer, PgDog supports transaction (and session) pooling, allowing
57+
100,000s of clients to use just a few PostgreSQL server connections.
6058

6159
📘 **[Transactions](https://docs.pgdog.dev/features/transaction-mode)**
6260

63-
### Plugins
64-
65-
PgDog comes with its own plugin system that loads them at runtime using a shared library interface.
66-
If a plugin can expose a predefined C API, it can be written in any language, including C/C++, Rust, Zig, Go, Python, Ruby, Java, and many more.
67-
68-
Plugins can be used to route queries to specific databases in a sharded configuration, or to
69-
split traffic between writes and reads in a mixed (primary & replicas) deployment. The plugin
70-
interface allows code execution at multiple stages of the request/response lifecycle, and can
71-
go as far as block or intercept queries and return custom results to the client.
72-
73-
Examples of plugins can be found in [examples](https://github.com/levkk/pgdog/tree/main/examples) and [plugins](https://github.com/levkk/pgdog/tree/main/plugins).
74-
75-
📘 **[Plugins](https://docs.pgdog.dev/features/plugins/)**
76-
7761
### Sharding
7862

79-
_This feature is a work in progress._
80-
81-
PgDog is able to handle databases with multiple shards by routing queries automatically to one or more shards. The `pgdog-routing` plugin parses
82-
queries, extracts tables and columns information, and calculates which shard(s) the query should go to based on the parameters. Not all operations are supported, but
83-
a lot of common use cases are working.
63+
PgDog is able to handle databases with multiple shards by routing queries automatically to one or more shards. Using the native PostgreSQL parser, PgDog understands queries, extracts sharding keys and determines the best routing strategy. For cross-shard queries, PgDog assembles results in memory and sends them all to the client transparently.
8464

85-
📘 **[Sharding](https://docs.pgdog.dev/features/sharding/)**
86-
87-
#### Local testing
88-
89-
The configuration files for a sharded database are provided in the repository. To make it work locally, create the required databases:
65+
#### Using `COPY`
9066

91-
```postgresql
92-
CREATE DATABASE shard_0;
93-
CREATE DATABASE shard_1;
67+
PgDog come with a CSV parser and can split a COPY command between all shards automatically. This allows clients to ingest data into sharded PostgreSQL without preprocessing.
9468

95-
GRANT CONNECT ON DATABASE shard_0 TO pgdog;
96-
GRANT CONNECT ON DATABASE shard_1 TO pgdog;
97-
```
69+
#### Logical replication
9870

99-
You can launch PgDog with the sharded configuration using the files provided in the repository:
71+
PgDog understands the PostgreSQL logical replication protocol and can split data between databases in the background and without downtime. This allows to shard existing databases and add more shards to existing clusters in production, without impacting database operations.
10072

101-
```bash
102-
cargo run -- --config pgdog-sharded.toml --users users-sharded.toml
103-
```
73+
📘 **[Sharding](https://docs.pgdog.dev/features/sharding/)**
10474

10575
### Configuration
10676

10777
PgDog is highly configurable and many aspects of its operation can be tweaked at runtime, without having
108-
to restart the process and break PostgreSQL connections. If you've used pgbouncer (or pgcat) before, the options
109-
will be familiar. If not, options are documented with examples.
78+
to restart the process and break PostgreSQL connections. If you've used PgBouncer (or PgCat) before, the options
79+
will be familiar. If not, they are documented with examples.
11080

11181
📘 **[Configuration](https://docs.pgdog.dev/configuration/)**
11282

11383
## Running PgDog locally
11484

11585
Install the latest version of the Rust compiler from [rust-lang.org](https://rust-lang.org).
116-
Once you have Rust installed, clone this repository and build the project in release mode:
86+
Clone this repository and build the project in release mode:
11787

11888
```bash
11989
cargo build --release
@@ -160,6 +130,18 @@ CREATE DATABASE pgdog;
160130
CREATE USER pgdog PASSWORD 'pgdog' LOGIN;
161131
```
162132

133+
#### Try sharding
134+
135+
The configuration files for a sharded database are provided in the repository. To make it work locally, create the required databases:
136+
137+
```postgresql
138+
CREATE DATABASE shard_0;
139+
CREATE DATABASE shard_1;
140+
141+
GRANT ALL ON DATABASE shard_0 TO pgdog;
142+
GRANT ALL ON DATABASE shard_1 TO pgdog;
143+
```
144+
163145
### Start PgDog
164146

165147
Running PgDog can be done with Cargo:
@@ -176,15 +158,11 @@ psql postgres://pgdog:[email protected]:6432/pgdog
176158

177159
## 🚦 Status 🚦
178160

179-
While a lot of "classic" features of PgDog, like load balancing and healthchecks, have been well tested in production and at scale, the current codebase has not. This project is just getting started and early adopters are welcome to try PgDog internally.
180-
181-
Status on features stability will be [updated regularly](https://docs.pgdog.dev/features/).
161+
This project is just getting started and early adopters are welcome to try PgDog internally. Status on features stability will be [updated regularly](https://docs.pgdog.dev/features/). Most features have tests and are benchmarked regularly for performance regressions.
182162

183163
## Performance
184164

185-
PgDog does its best to minimize its impact on overall database performance. Using Rust and Tokio is a great start for a fast network proxy, but additional
186-
care is also taken to perform as few operations as possible while moving data between client and server sockets. Some benchmarks are provided
187-
to help set a baseline.
165+
PgDog does its best to minimize its impact on overall database performance. Using Rust and Tokio is a great start for a fast network proxy, but additional care is also taken to perform as few operations as possible while moving data between client and server sockets. Some benchmarks are provided to help set a baseline.
188166

189167
📘 **[Architecture & benchmarks](https://docs.pgdog.dev/architecture/)**
190168

0 commit comments

Comments
 (0)