Skip to content

Commit

Permalink
feat: create a configurable limits section #DA-1282 (#6244)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur-arch authored Sep 11, 2024
1 parent ad9955b commit 5fb372a
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 62 deletions.
6 changes: 3 additions & 3 deletions content/200-orm/500-reference/250-error-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,13 @@ The included usage of the current plan has been exceeded. This can only occur on

#### `P6004` (`QueryTimeout`)

The global timeout of Accelerate has been exceeded. You can find the limit [here](/accelerate/limitations#query-timeout-limit).
The global timeout of Accelerate has been exceeded. You can find the limit [here](/accelerate/connection-pooling#query-timeout-limit).

> Also see the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout) for more information.
#### `P6005` (`InvalidParameters`)

The user supplied invalid parameters. Currently only relevant for transaction methods. For example, setting a timeout that is too high. You can find the limit [here](/accelerate/limitations#interactive-transactions-query-timeout-limit).
The user supplied invalid parameters. Currently only relevant for transaction methods. For example, setting a timeout that is too high. You can find the limit [here](/accelerate/connection-pooling#interactive-transactions-query-timeout-limit).

#### `P6006` (`VersionNotSupported`)

Expand All @@ -492,7 +492,7 @@ The engine failed to start. For example, it couldn't establish a connection to t
#### `P6009` (`ResponseSizeLimitExceeded`)

The global response size limit of Accelerate has been exceeded. You can find the limit [here](/accelerate/limitations#response-size-limit).
The global response size limit of Accelerate has been exceeded. You can find the limit [here](/accelerate/connection-pooling#response-size-limit).

> Also see the [troubleshooting guide](/accelerate/troubleshoot#p6009-responsesizelimitexceeded) for more information.
Expand Down
46 changes: 46 additions & 0 deletions content/300-accelerate/250-connection-pooling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,49 @@ postgresql://user:password@localhost:5432/db?connection_limit=10&pool_timeout=20
The default value for `pool_timeout` is `10` seconds.

</Admonition>

## Configuring query limits

You can configure the minimum and maximum query response size, query duration, and transaction limits when using Prisma Accelerate from the **Settings** tab in your Accelerate-enabled project environment.

### Query timeout limit

Accelerate has a default global timeout of `10s` for each query, configurable using the slider labeled **Query duration**, based on your subscription plan:

| Plan | Starter | Pro | Business |
|----------|---------------|--------------|---------------|
| Query timeout | Up to 10 seconds | Up to 20 seconds | Up to 60 seconds |

See the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout) and our [pricing page](https://www.prisma.io/pricing#accelerate) for more information.

:::warning
While you can increase the query timeout, it’s recommended to inspect and optimize your database queries if they take longer than 10 seconds. This helps reduce stress on your underlying database, as long-running queries often indicate a need for optimization. Learn more in the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout).
:::

### Interactive transactions query timeout limit

Accelerate has a default global timeout of `15s` for each [interactive transaction](/orm/prisma-client/queries/transactions#interactive-transactions), configurable using the slider labeled **Transaction duration**, based on your subscription plan:

| Plan | Starter | Pro | Business |
|----------------------------|---------------|--------------|---------------|
| Interactive transaction limit | Up to 15 seconds | Up to 30 seconds | Up to 90 seconds |

See the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout) and our [pricing page](https://www.prisma.io/pricing#accelerate) for more information.

:::warning
While you can increase the interactive transaction timeout limit, it’s recommended to inspect and optimize your database transactions if they take longer than 15 seconds. Long-running transactions can negatively impact performance and often signal the need for optimization. Learn more in the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout) and review the [warning in the Interactive Transactions section](/orm/prisma-client/queries/transactions#interactive-transactions-1) in our documentation.
:::

### Response size limit

Accelerate has a default global response size limit of `5MB`, configurable using the slider labeled **Response size**, based on your subscription plan:

| Plan | Starter | Pro | Business |
|----------|---------------|--------------|---------------|
| Query size | Up to 5MB | Up to 10MB | Up to 20MB |

See the [troubleshooting guide](/accelerate/troubleshoot#p6009-responsesizelimitexceeded) and our [pricing page](https://www.prisma.io/pricing#accelerate) for more information.

:::warning
While you can increase the query response size, it’s recommended to limit data retrieval to what you actually need. This improves database performance, reduces stress on your database, and makes your frontend applications more responsive. Queries exceeding 5 MB in size often indicate a need for optimization. Learn more in the [troubleshooting guide](/accelerate/troubleshoot#p6009-responsesizelimitexceeded).
:::
48 changes: 0 additions & 48 deletions content/300-accelerate/500-limitations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,54 +12,6 @@ Below are descriptions of known limitations when using Accelerate. If you encoun

</TopBlock>

## Query timeout limit

Accelerate has a default global timeout of `10s` for each query that you can configure depending on your subscription plan:

| Plan | Starter | Pro | Business |
|----------|---------------|--------------|---------------|
| Query timeout | Up to 10 seconds | Up to 20 seconds | Up to 60 seconds |

See the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout) and our [pricing page](https://www.prisma.io/pricing#accelerate) for more information.

:::warning

While you can increase the query timeout, it’s recommended to inspect and optimize your database queries if they take longer than 10 seconds. This will help reduce stress on your underlying database, as long-running queries often indicate a need for optimization. Learn more in the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout).

:::

## Interactive transactions query timeout limit

Accelerate has a default global timeout of `15s` for each [interactive transaction](/orm/prisma-client/queries/transactions#interactive-transactions) that you can configure depending on your pricing plan:

| Plan | Starter | Pro | Business |
|----------------------------|---------------|--------------|---------------|
| Interactive transaction limit | Up to 15 seconds | Up to 30 seconds | Up to 90 seconds |

See the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout) and our [pricing page](https://www.prisma.io/pricing#accelerate) for more information.

:::warning

While you can increase the interactive transaction timeout limit, it’s recommended to inspect and optimize your database transactions if they take longer than 15 seconds to reduce stress on your underlying database. Long-running transactions can negatively impact performance and typically indicate a need for optimization. Learn more in the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout) and review the [warning in the Interactive Transactions section](/orm/prisma-client/queries/transactions#interactive-transactions-1) in our documentation.

:::

## Response size limit

Accelerate has a default global response size limit of `5MB` that you can configure depending on your subscription plan:

| Plan | Starter | Pro | Business |
|----------|---------------|--------------|---------------|
| Query size | Up to 5MB | Up to 10MB | Up to 20MB |

See the [troubleshooting guide](/accelerate/troubleshoot#p6009-responsesizelimitexceeded) and our [pricing page](https://www.prisma.io/pricing#accelerate) for more information.

:::warning

While you can increase the query response size, it’s recommended to limit data retrieval to what you actually need. This improves database performance, reduces stress on your database, and makes your frontend apps more responsive. Queries with response sizes larger than 5 MB often indicate a need for optimization. Learn more in the [troubleshooting guide](/accelerate/troubleshoot#p6009-responsesizelimitexceeded).

:::

## Cannot cache raw queries

At the moment, it is not possible to cache the responses of [raw queries](/orm/prisma-client/using-raw-sql/raw-queries).
Expand Down
Loading

0 comments on commit 5fb372a

Please sign in to comment.