Skip to content

Commit 68400b9

Browse files
thomasgauvinsejokerOxyjun
authored
Update how-hyperdrive-works.mdx (#19035)
* Update how-hyperdrive-works.mdx * Update src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx Co-authored-by: Yevgen Safronov <[email protected]> * Update src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx Co-authored-by: Yevgen Safronov <[email protected]> * Update src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx * Update src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx * Update src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx * Update src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx * Update src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx * Update src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx --------- Co-authored-by: Yevgen Safronov <[email protected]> Co-authored-by: Jun Lee <[email protected]>
1 parent 7724b24 commit 68400b9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/content/docs/hyperdrive/configuration/how-hyperdrive-works.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,21 @@ If the connection pool does not have pre-existing connections, it will establish
3131
Hyperdrive automatically manages the connection pool properties for you, including limiting the total number of connections to your origin database. Refer to [Limits](/hyperdrive/platform/limits/) to learn more.
3232
:::
3333

34-
The connection pool operates in transaction mode, where the client that executes the query communicates through a single connection for the duration of a transaction.
34+
## Pooling mode
3535

36-
When that transaction has completed, the connection is returned to the pool.
36+
The Hyperdrive connection pooler operates in transaction mode, where the client that executes the query communicates through a single connection for the duration of a transaction. When that transaction has completed, the connection is returned to the pool.
37+
38+
39+
Hyperdrive supports [`SET` statements](https://www.postgresql.org/docs/current/sql-set.html) for the duration of a transaction or a query. For instance, if you manually create a transaction with `BEGIN`/`COMMIT`, `SET` statements within the transaction will take effect. Moreover, a query that includes a `SET` command (`SET X; SELECT foo FROM bar;`) will also apply the `SET` command. When a connection is returned to the pool, the connection is `RESET` such that the `SET` commands will not take effect on subsequent queries.
40+
41+
This implies that a single Worker invocation may obtain multiple connections to perform its database operations and may need to `SET` any configurations for every query or transaction. It is not recommended to wrap multiple database operations with a single transaction to maintain the `SET` state. Doing so will affect the performance and scaling of Hyperdrive as the connection cannot be reused by other Worker isolates for the duration of the transaction.
3742

3843
Hyperdrive supports named prepared statements as implemented in the `postgres.js` and `node-postgres` drivers. Named prepared statements in other drivers may have worse performance.
3944

45+
## Unsupported PostgreSQL features:
46+
4047
Hyperdrive does not support the following PostgreSQL features:
4148

42-
* `SET` statements.
4349
* SQL-level management of prepared statements, such as using `PREPARE`, `DISCARD`, `DEALLOCATE`, or `EXECUTE`.
4450
* Advisory locks ([PostgreSQL documentation](https://www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS)).
4551
* `LISTEN` and `NOTIFY`.

0 commit comments

Comments
 (0)