Skip to content

Commit eb93410

Browse files
authored
feat: update docs even more (#84)
1 parent 88ed113 commit eb93410

42 files changed

Lines changed: 1392 additions & 605 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/client-drivers.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,28 @@ Connection conn = DriverManager.getConnection(url, "user", "password");
5050

5151
This doesn't cause any query routing issues; however, PgDog can't effectively cache the query syntax tree and has to parse queries _every time_ they are executed. This is computationally expensive. Consider switching to `psycopg` (version 3) or enabling our Rust-native query parser:
5252

53-
```toml
54-
[general]
55-
query_parser_engine = "pg_query_raw"
56-
```
53+
=== "pgdog.toml"
54+
```toml
55+
[general]
56+
query_parser_engine = "pg_query_raw"
57+
```
58+
=== "Helm chart"
59+
```yaml
60+
queryParserEngine: pg_query_raw
61+
```
5762

5863
We benchmarked this to be 5 times faster than normal `pg_query` parsing, which should help.
5964

6065
### Prisma
6166

6267
Prisma doesn't correctly use the `IN` clause with arrays, causing it to generate a very large number of unique prepared statements. This is not a big problem, but if left unchecked, can cause heavy memory usage in PgDog. Consider setting a lower prepared statements [cache limit](features/prepared-statements.md#cache-limit):
6368

64-
```toml
65-
[general]
66-
prepared_statements_limit = 1_000
67-
```
69+
=== "pgdog.toml"
70+
```toml
71+
[general]
72+
prepared_statements_limit = 1_000
73+
```
74+
=== "Helm chart"
75+
```yaml
76+
preparedStatementsLimit: 1_000
77+
```

docs/configuration/index.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ PgDog uses the [TOML](https://toml.io/en/) configuration language for its two co
2424
password = "pgdog"
2525
database = "pgdog"
2626
```
27+
=== "Helm chart"
28+
```yaml
29+
databases:
30+
- name: pgdog
31+
host: 127.0.0.1
32+
users:
33+
- name: pgdog
34+
password: pgdog
35+
database: pgdog
36+
```
2737

2838
By default, PgDog looks for both configuration files in the current working directory (`$PWD`). Alternatively, you can pass the
2939
`--config=<path>` and `--users=<path>` arguments on startup.
@@ -47,10 +57,15 @@ Hot reload can be triggered by sending `SIGHUP` to the `pgdog` process or by con
4757

4858
To make things simpler, all units of time are in milliseconds. For example, if you want to set the pool checkout timeout to 5 seconds, convert it to 5000ms instead:
4959

50-
```toml
51-
[general]
52-
checkout_timeout = 5_000
53-
```
60+
=== "pgdog.toml"
61+
```toml
62+
[general]
63+
checkout_timeout = 5_000
64+
```
65+
=== "Helm chart"
66+
```yaml
67+
checkoutTimeout: 5_000
68+
```
5469

5570
!!! note "TOML syntax"
5671
Since PgDog uses TOML, both `5000` and `5_000` are valid numbers. Configuration will fail to load if non-integer values are used, e.g. "5s" or "53.5".

docs/configuration/pgdog.toml/admin.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ icon: material/security
77
Admin database settings control access to the [admin](../../administration/index.md) database which contains real time statistics about internal operations
88
of PgDog. For example:
99

10-
```toml
11-
[admin]
12-
password = "hunter2"
13-
```
10+
=== "pgdog.toml"
11+
```toml
12+
[admin]
13+
password = "hunter2"
14+
```
15+
=== "Helm chart"
16+
```yaml
17+
adminPassword: "hunter2"
18+
```
1419

1520
### `name`
1621

docs/configuration/pgdog.toml/control.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,27 @@ Control settings configure PgDog's connection to the PgDog control plane.
99
!!! note "Enterprise edition"
1010
This feature is available in [Enterprise Edition](../../enterprise_edition/index.md) only.
1111

12-
```toml
13-
[control]
14-
endpoint = "http://localhost:8080"
15-
token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
16-
metrics_interval = 1000
17-
stats_interval = 5000
18-
active_queries_interval = 5000
19-
request_timeout = 1000
20-
```
12+
=== "pgdog.toml"
13+
```toml
14+
[control]
15+
endpoint = "http://localhost:8080"
16+
token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
17+
metrics_interval = 1000
18+
stats_interval = 5000
19+
active_queries_interval = 5000
20+
request_timeout = 1000
21+
```
22+
=== "Helm chart"
23+
```yaml
24+
control:
25+
enabled: true
26+
endpoint: "http://localhost:8080"
27+
token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
28+
metricsInterval: 1000
29+
statsInterval: 5000
30+
activeQueriesInterval: 5000
31+
requestTimeout: 1000
32+
```
2133

2234
### `endpoint`
2335

docs/configuration/pgdog.toml/databases.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,34 @@ Database settings configure which databases PgDog is managing. This is a TOML li
77

88
For each database instance, add a `[[databases]]` entry to `pgdog.toml`. For example:
99

10-
```toml
11-
[[databases]]
12-
name = "prod"
13-
host = "10.0.0.1"
14-
port = 5432
15-
shard = 0
16-
17-
[[databases]]
18-
name = "prod"
19-
host = "10.0.0.2"
20-
port = 5432
21-
role = "replica"
22-
shard = 0
23-
```
10+
=== "pgdog.toml"
11+
```toml
12+
[[databases]]
13+
name = "prod"
14+
host = "10.0.0.1"
15+
port = 5432
16+
shard = 0
17+
18+
[[databases]]
19+
name = "prod"
20+
host = "10.0.0.2"
21+
port = 5432
22+
role = "replica"
23+
shard = 0
24+
```
25+
=== "Helm chart"
26+
```yaml
27+
databases:
28+
- name: prod
29+
host: 10.0.0.1
30+
port: 5432
31+
shard: 0
32+
- name: prod
33+
host: 10.0.0.2
34+
port: 5432
35+
role: replica
36+
shard: 0
37+
```
2438

2539
### `name`
2640

docs/configuration/pgdog.toml/memory.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@ icon: material/memory
66

77
Memory settings control buffer sizes used by PgDog for network I/O and task execution.
88

9-
```toml
10-
[memory]
11-
net_buffer = 4096
12-
message_buffer = 4096
13-
stack_size = 2097152
14-
```
9+
=== "pgdog.toml"
10+
```toml
11+
[memory]
12+
net_buffer = 4096
13+
message_buffer = 4096
14+
stack_size = 2097152
15+
```
16+
=== "Helm chart"
17+
```yaml
18+
memoryNetBuffer: 4096
19+
memoryMessageBuffer: 4096
20+
memoryStackSize: 2097152
21+
```
1522

1623
### `net_buffer`
1724

docs/configuration/pgdog.toml/mirroring.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@ icon: material/mirror-rectangle
88

99
For example:
1010

11-
```toml
12-
[[mirroring]]
13-
source_db = "source"
14-
destination_db = "dest"
15-
queue_length = 500
16-
exposure = 0.1
17-
```
11+
=== "pgdog.toml"
12+
```toml
13+
[[mirroring]]
14+
source_db = "source"
15+
destination_db = "dest"
16+
queue_length = 500
17+
exposure = 0.1
18+
```
19+
=== "Helm chart"
20+
```yaml
21+
mirrors:
22+
- sourceDb: source
23+
destinationDb: dest
24+
queueLength: 500
25+
exposure: 0.1
26+
```
1827

1928
### `source_db`
2029

docs/configuration/pgdog.toml/network.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ icon: material/network
66

77
PgDog speaks the Postgres protocol which, underneath, uses TCP. Optimal TCP settings are necessary to quickly recover from database incidents. For example:
88

9-
```toml
10-
[tcp]
11-
keepalive = true
12-
time = 60_000
13-
interval = 60_000
14-
retries = 3
15-
user_timeout = 5_000
16-
```
9+
=== "pgdog.toml"
10+
```toml
11+
[tcp]
12+
keepalive = true
13+
time = 60_000
14+
interval = 60_000
15+
retries = 3
16+
user_timeout = 5_000
17+
```
18+
=== "Helm chart"
19+
```yaml
20+
tcpKeepalive: true
21+
tcpTime: 60_000
22+
tcpInterval: 60_000
23+
tcpRetries: 3
24+
tcpUserTimeout: 5_000
25+
```
1726

1827
To be consistent with the rest of PgDog documentation, units of time are in milliseconds. However, many TCP implementations only support seconds. Consider using round units, e.g., `1_000` milliseconds = 1 second.
1928

docs/configuration/pgdog.toml/plugins.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ icon: material/power-plug
88

99
Plugins are a TOML list, so for each plugin you want to enable, add a `[[plugins]]` entry to `pgdog.toml`. For example:
1010

11-
```toml
12-
[[plugins]]
13-
name = "bob_router"
14-
15-
[[plugins]]
16-
name = "alice_router"
17-
```
11+
=== "pgdog.toml"
12+
```toml
13+
[[plugins]]
14+
name = "bob_router"
15+
16+
[[plugins]]
17+
name = "alice_router"
18+
```
19+
=== "Helm chart"
20+
```yaml
21+
plugins:
22+
- name: bob_router
23+
- name: alice_router
24+
```
1825

1926
!!! note
2027
Plugins can only be configured at PgDog startup. They cannot be changed after
@@ -27,9 +34,15 @@ name is `router`, PgDog will look for `librouter.so` on Linux, `librouter.dll` o
2734

2835
Additionally, you can pass the relative or absolute path to the shared library itself:
2936

30-
```toml
31-
[[plugins]]
32-
name = "/opt/plugins/librouter.so"
33-
```
37+
=== "pgdog.toml"
38+
```toml
39+
[[plugins]]
40+
name = "/opt/plugins/librouter.so"
41+
```
42+
=== "Helm chart"
43+
```yaml
44+
plugins:
45+
- name: /opt/plugins/librouter.so
46+
```
3447

3548
Make sure the user running PgDog has read & execute permissions on the library.

docs/configuration/pgdog.toml/rewrite.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@ icon: material/alpha-r-box-outline
66

77
The `rewrite` section controls PgDog's automatic SQL rewrites for sharded databases. It affects sharding key updates and multi-tuple inserts. Either one can be toggled separately:
88

9-
```toml
10-
[rewrite]
11-
enabled = false
12-
shard_key = "error"
13-
split_inserts = "error"
14-
primary_key = "ignore"
15-
```
9+
=== "pgdog.toml"
10+
```toml
11+
[rewrite]
12+
enabled = false
13+
shard_key = "error"
14+
split_inserts = "error"
15+
primary_key = "ignore"
16+
```
17+
=== "Helm chart"
18+
```yaml
19+
rewrite:
20+
enabled: false
21+
shardKey: "error"
22+
splitInserts: "error"
23+
primaryKey: "ignore"
24+
```
1625

1726
| Setting | Description | Default |
1827
| --- | --- | --- |

0 commit comments

Comments
 (0)