Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---
title: Configure Prisma Client with PgBouncer
metaTitle: Configure Prisma Client with PgBouncer
toc_max_heading_level: 2
---

<TopBlock>

An external connection pooler like PgBouncer holds a connection pool to the database, and proxies incoming client connections by sitting between Prisma Client and the database. This reduces the number of processes a database has to handle at any given time.

Usually, this works transparently, but some connection poolers only support a limited set of functionality. One common feature that external connection poolers do not support are named prepared statements, which Prisma ORM uses. For these cases, Prisma ORM can be configured to behave differently.

</TopBlock>
:::info

Looking for an easy, infrastructure-free solution? Try [Prisma Accelerate](https://www.prisma.io/accelerate?utm_source=docs&utm_campaign=pgbouncer-help)! It requires little to no setup and works seamlessly with all databases supported by Prisma ORM.

Ready to begin? Get started with Prisma Accelerate by clicking [here](https://console.prisma.io?utm_source=docs&utm_campaign=pgbouncer-help).
:::

## PgBouncer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async function getUsers() {
}
```

For serverless development environments with frameworks that use HMR (Hot Module Replacement), ensure you properly handle a [single instance of Prisma in development](/orm/more/help-and-troubleshooting/help-articles/nextjs-prisma-client-dev-practices).
For serverless development environments with frameworks that use HMR (Hot Module Replacement), ensure you properly handle a [single instance of Prisma in development](/orm/more/help-and-troubleshooting/nextjs-help#best-practices-for-using-prisma-client-in-development).

## Solving the n+1 problem

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ To do so, you can use plugins that let you copy over static assets:
| Bundler | Plugin |
| :---------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- |
| Webpack | [`copy-webpack-plugin`](https://github.com/webpack-contrib/copy-webpack-plugin#copy-webpack-plugin) |
| Webpack (with [Next.js monorepo](/orm/more/help-and-troubleshooting/help-articles/nextjs-prisma-client-monorepo)) | [`nextjs-monorepo-workaround-plugin`](https://www.npmjs.com/package/@prisma/nextjs-monorepo-workaround-plugin) |
| Webpack (with [Next.js monorepo](/orm/more/help-and-troubleshooting/nextjs-help#setting-up-prisma-orm-in-a-monorepo)) | [`nextjs-monorepo-workaround-plugin`](https://www.npmjs.com/package/@prisma/nextjs-monorepo-workaround-plugin) |
| Parcel | [`parcel-plugin-static-files-copy`](https://github.com/elwin013/parcel-plugin-static-files-copy#readme) |
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ The following table shows which SQL operations are currently supported by legacy
| Create indexes | `CREATE INDEX` | ✔️ |
| Cascading deletes | `ON DELETE` | No (workaround: manually add in SQL and introspect) |
| Cascading updates | `ON UPDATE` | No |
| Data validation | `CHECK` | No ([workaround](/orm/more/help-and-troubleshooting/help-articles/check-constraints)) |
| Data validation | `CHECK` | No ([workaround](/orm/more/help-and-troubleshooting/check-constraints)) |

Note that this table assumes that the operation is also supported by the underlying database. For example, `ENUM` is not supported in SQLite. This means that you also can't use `enum` when using legacy Prisma Migrate.

Expand Down
4 changes: 2 additions & 2 deletions content/200-orm/500-reference/050-prisma-client-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3502,7 +3502,7 @@ const result = await prisma.user.update({
<Admonition type="info">

- From version 4.3.0, you can also use these operators to compare _fields_ in the same model [with the `<model>.fields` property](#compare-columns-in-the-same-table).
- In versions before 4.3.0, you can compare fields in the same model [with raw queries](/orm/more/help-and-troubleshooting/help-articles/comparing-columns-through-raw-queries).
- In versions before 4.3.0, you can compare fields in the same model [with raw queries](/orm/more/help-and-troubleshooting/comparing-columns-through-raw-queries).

</Admonition>

Expand Down Expand Up @@ -5525,7 +5525,7 @@ This feature was moved to general availability in version 5.0.0 and was availabl

<Admonition type="info">

In the following situations, you must [use raw queries to compare columns in the same table](/orm/more/help-and-troubleshooting/help-articles/comparing-columns-through-raw-queries):
In the following situations, you must [use raw queries to compare columns in the same table](/orm/more/help-and-troubleshooting/comparing-columns-through-raw-queries):

- If you use a version earlier than 4.3.0
- If you want to use a unique filter, such as [`findUnique`](#findunique) or [`findUniqueOrThrow`](#finduniqueorthrow)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ filterPosts: (parent, args, ctx) => {

Now whenever you type `ctx.` VS Code will provide unnecessary options in the autocomplete which is undesirable.

![Unwanted autocomplete values by VSCode](./unwanted-autocomplete-values-in-vscode.png)
![Unwanted autocomplete values by VSCode](/img/orm/unwanted-autocomplete-values-in-vscode.png)

VS Code doesn't know the _type_ of the `context` object so it can't provide any intellisense for it, which is why unwanted suggestions are displayed.

Expand Down Expand Up @@ -69,7 +69,7 @@ This will tell VS Code that the `context` has a property named `prisma` and the

And voilà, autocompletion in plain JavaScript.

![The correct parameters for context are obtained](./prisma-autocompletion-in-js.png)
![The correct parameters for context are obtained](/img/orm/prisma-autocompletion-in-js.png)

The final file should look something like:

Expand Down

This file was deleted.

Loading
Loading