You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example shows you how to connect Hyperdrive to a [Prisma Postgres](https://www.prisma.io/postgres) database.
14
14
@@ -19,21 +19,55 @@ You can connect Hyperdrive to any existing Prisma Postgres database by using you
19
19
### Prisma Data Platform
20
20
21
21
1. Go to the [**Prisma Data Platform Console**](https://console.prisma.io/) and select the project (database) you wish to connect to.
22
-
2. Navigate to your database settings and copy the connection string for your Prisma Postgres database.
23
-
3. Ensure the connection string includes the necessary credentials and database name.
22
+
2. Navigate to your database settings, select **Connect to your database**, select **Any client**, and copy the connection string for your Prisma Postgres database.
23
+
3. You must append **`postgres`** as the database in your connection string. Ensure the connection string includes the necessary credentials according to the format documented below:
Prisma Postgres has limits on the amount of connections that can be made direct to the database using Hyperdrive. Refer to [Prisma Postgres limits](https://www.prisma.io/docs/postgres/database/direct-connections?utm_source=website&utm_medium=postgres-page#connection-limit) to know the specific limits that apply to your database.
37
+
31
38
:::note
32
39
33
-
When configuring Hyperdrive for Prisma Postgres, set the maximum connections to 15 to stay within Prisma Postgres connection limits. You can configure this in the Cloudflare dashboard under Hyperdrive settings, or contact support if you need to adjust connection pooling settings.
40
+
Hyperdrive's origin connection limit refers to the amount of database connections that Hyperdrive makes to your origin database (in this case, Prisma Postgres).
41
+
This number should be less than your Prisma Postgres database since Hyperdrive's limit is a soft limit, and Hyperdrive may create more connections in the event of networking disruptions that prevent existing connections from being used.
34
42
35
43
:::
36
44
45
+
<Tabs>
46
+
47
+
<TabItemlabel={"Dashboard"}>
48
+
1. From the [Cloudflare Hyperdrive dashboard](https://dash.cloudflare.com/?to=/:account/workers/hyperdrive), select your newly created Hyperdrive configuration.
49
+
2. Navigate to **Settings**.
50
+
3. In **Origin connection limit**, select **Edit Settings** and set your max connections to a number that is less than your Prisma connection limit.
51
+
</TabItem>
52
+
<TabItemlabel={"Wrangler CLI"}>
53
+
54
+
1. Edit your existing Hyperdrive configuration with the `--origin-connection-limit` parameter:
Replace `<HYPERDRIVE_ID>` with your Hyperdrive configuration ID and set the connection limit to a number that is less than your Prisma connection limit.
61
+
62
+
2. Verify the configuration change:
63
+
64
+
```bash
65
+
npx wrangler hyperdrive get \<HYPERDRIVE_ID\>
66
+
```
67
+
68
+
</TabItem>
69
+
</Tabs>
70
+
37
71
:::note
38
72
39
73
When connecting to a Prisma Postgres database with Hyperdrive, you should use a driver like [node-postgres (pg)](/hyperdrive/examples/connect-to-postgres/postgres-drivers-and-libraries/node-postgres/) or [Postgres.js](/hyperdrive/examples/connect-to-postgres/postgres-drivers-and-libraries/postgres-js/) to connect directly to the underlying PostgreSQL database instead of the Prisma Accelerate extension. Hyperdrive is optimized for database access for Workers and will perform global connection pooling and fast query routing by connecting directly to your database.
0 commit comments