Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions docs/configuration/pgdog.toml/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,14 @@ Default: **`disabled`**

### `prepared_statements`

Enables support for prepared statements. Available options are:

- `disabled`
- `extended`
- `extended_anonymous`
- `full`

`full` enables support for rewriting prepared statements sent over the simple protocol. `extended` handles prepared statements sent normally
using the extended protocol. `extended_anonymous` caches and rewrites unnamed prepared statements, which is useful for some legacy client drivers.
Controls which prepared statement protocols PgDog rewrites for its global cache.

| Setting | Extended named | Extended anonymous | Simple `PREPARE`/`EXECUTE` | Notes |
|---|---|---|---|---|
| `disabled` | no | no | no | Statements are forwarded as-is with no rewriting. |
| `extended` | yes | no | no | Default. Rewrites named extended-protocol statements (`Parse`/`Bind`/`Execute`). |
| `extended_anonymous` | yes | yes | no | Also rewrites unnamed (anonymous) extended-protocol statements. Useful for drivers like `go/pq`. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `extended_anonymous` | yes | yes | no | Also rewrites unnamed (anonymous) extended-protocol statements. Useful for drivers like `go/pq`. |
| `extended_anonymous` | yes | yes | no | Also rewrites unnamed (anonymous) extended-protocol statements. |

No longer necessary, I fixed this a week ago or so. It can be used to disable prepared statements on the server, however. Kind of a neat trick, but kind of hard to explain. I would omit this mode for now from the docs to avoid confusion.

| `full` | yes | no | yes | Superset of `extended`. Also rewrites simple-protocol `PREPARE`/`EXECUTE`. Requires parsing every query; higher CPU cost. |

Default: **`extended`**

Expand Down
3 changes: 3 additions & 0 deletions docs/features/prepared-statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ PREPARE __pgdog_1 AS SELECT * FROM users;
Statements sent over the simple protocol are not checked against the global cache. Each new statement is given a unique
global name. Since this requires PgDog to parse _each_ incoming query, and that's computationally expensive, this feature is **disabled** by default.

!!! note
`full` extends `extended`: it rewrites named extended-protocol statements in addition to simple-protocol `PREPARE`/`EXECUTE`.

You can enable it in [`pgdog.toml`](../configuration/pgdog.toml/general.md#prepared_statements):

```toml
Expand Down
Loading