Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 3 additions & 9 deletions apps/docs/content/docs/accelerate/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,9 @@ If VS Code does not recognize the `$extends` method, refer to [this section](/ac

Since [extensions are applied one after another](/orm/prisma-client/client-extensions#conflicts-in-combined-extensions), make sure you apply them in the correct order. Extensions cannot share behavior and the last extension applied takes precedence.

If you are using [Prisma Optimize](/optimize) in your application, make sure you apply it _before_ the Accelerate extension. For example:

```ts
const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
})
.$extends(withOptimize())
.$extends(withAccelerate());
```
:::note
If you were previously using the Prisma Optimize extension, note that Optimize has evolved into [Query Insights](/postgres/query-insights), which is built into Prisma Postgres and requires no client extension.
:::
Comment on lines +154 to +156
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.

⚠️ Potential issue | 🟡 Minor

Scope this note to Prisma Postgres users.

This page supports multiple databases, but Line 155 reads like Query Insights is the replacement for any former Optimize user. Since the linked feature is Prisma Postgres-only, please add that qualifier here so non-Postgres readers are not sent to a flow they cannot use.

Suggested wording
 :::note
-If you were previously using the Prisma Optimize extension, note that Optimize has evolved into [Query Insights](/postgres/query-insights), which is built into Prisma Postgres and requires no client extension.
+If you were previously using the Prisma Optimize extension with Prisma Postgres, note that Optimize has evolved into [Query Insights](/postgres/query-insights), which is built into Prisma Postgres and requires no client extension.
 :::
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:::note
If you were previously using the Prisma Optimize extension, note that Optimize has evolved into [Query Insights](/postgres/query-insights), which is built into Prisma Postgres and requires no client extension.
:::
:::note
If you were previously using the Prisma Optimize extension with Prisma Postgres, note that Optimize has evolved into [Query Insights](/postgres/query-insights), which is built into Prisma Postgres and requires no client extension.
:::
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/docs/content/docs/accelerate/getting-started.mdx` around lines 154 -
156, The note inside the :::note block currently implies Query Insights replaces
Prisma Optimize for all users; update that note to scope it to Prisma Postgres
users by explicitly mentioning "Prisma Postgres" (e.g., "If you were previously
using the Prisma Optimize extension and use Prisma Postgres, note that Query
Insights..."), and ensure the sentence still states that Query Insights is built
into Prisma Postgres and requires no client extension; edit the :::note block
containing the phrase "Query Insights" to include this qualifier so non-Postgres
readers are not redirected to a Postgres-only flow.


### 2.5. Use Accelerate in your database queries

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/console/concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ In each workspace, you can:
- manage billing, i.e. select a [subscription plan](https://www.prisma.io/pricing?utm_source=docs&utm_medium=platform-docs), configure payment methods, or view the invoice history.
- view the usage of your enabled Prisma products across all projects in that workspace.
- invite other users to collaborate in the workspace.
- access the [Optimize dashboard](https://console.prisma.io/optimize?utm_source=docs&utm_medium=optimize-docs) to measure query performance and receive AI-powered recommendations.
- access [Query Insights](/postgres/query-insights) to measure query performance and receive AI-powered recommendations (available with Prisma Postgres).

### CLI commands

Expand Down
1 change: 0 additions & 1 deletion apps/docs/content/docs/console/features/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"title": "Features",
"pages": [
"metrics",
"optimize",
"api-keys"
]
}
31 changes: 8 additions & 23 deletions apps/docs/content/docs/console/features/optimize.mdx
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
---
title: Optimize
description: Access the Optimize dashboard and generate API keys for query performance monitoring
metaTitle: Optimize in Console | Query Performance Dashboard
metaDescription: 'Access the Prisma Optimize dashboard from Console. Generate API keys for query performance monitoring. Enable OPTIMIZE_API_KEY in your project.'
description: 'Prisma Optimize has evolved into Query Insights'
url: /console/features/optimize
metaTitle: Optimize → Query Insights
metaDescription: 'Prisma Optimize is now Query Insights, built into Prisma Postgres.'
---

You can access Optimize within your [Prisma Data Platform account](https://console.prisma.io/optimize) workspace.
:::warning
Prisma Optimize has evolved into **[Query Insights](/postgres/query-insights)**, now built directly into Prisma Postgres.

## Accessing the Optimize dashboard
Query Insights is accessible from your Prisma Postgres dashboard — no separate API keys or setup required.

To access the Optimize dashboard in your desired workspace:

1. Click the **Optimize** tab on the left navigation.
2. Click the **Generate API key** button.

## Generating an Optimize API key

To obtain the Optimize API key:

1. Navigate to the workspace where you want to use Optimize.
2. Ensure that Optimize is launched. If it isn't, click the **Generate API key** button.
3. In Optimize, click your profile name in the top right corner of the navbar.
4. Select **Settings**.
5. Click **Create API key**.
6. Enter a name for the API key in the **Name** field, then click **Create**.
7. Copy the API key and store it securely. This will be used in your project's [`.env` file](/optimize/getting-started) via the `"OPTIMIZE_API_KEY"`. Finally, click the **"I've stored it securely"** button.

You now have your Optimize API key.
[Learn more about Query Insights →](/postgres/query-insights)
:::
5 changes: 1 addition & 4 deletions apps/docs/content/docs/console/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Getting Started
description: Quick start guide for setting up and using the Prisma Console
metaTitle: Prisma Console Getting Started | Setup in 6 Steps
metaDescription: 'Set up Prisma Console: sign in with GitHub, create workspace and project, provision database or environment, generate API keys for Accelerate or Optimize.'
metaDescription: 'Set up Prisma Console: sign in with GitHub, create workspace and project, provision database or environment, and generate API keys.'
url: /console/getting-started
---

Expand Down Expand Up @@ -110,9 +110,6 @@ Add the API key to your `.env` file:
```bash
# For Accelerate
DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=YOUR_API_KEY"

# For Optimize
OPTIMIZE_API_KEY="YOUR_API_KEY"
```

## Next steps
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/console/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metaDescription: Learn about the Console to integrate the Prisma Data Platform p
The [Console](https://console.prisma.io/login) enables you to manage and configure your projects that use Prisma products, and helps you integrate them into your application:


- [Optimize](/optimize): Provides you with recommendations that can help you make your database queries faster.
- [Query Insights](/postgres/query-insights): Built-in query performance insights for Prisma Postgres, helping you identify and fix slow queries.
- [Prisma Postgres](/postgres): A managed PostgreSQL database that is optimized for Prisma ORM.

## Getting started
Expand Down
1 change: 0 additions & 1 deletion apps/docs/content/docs/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"guides",
"studio",
"accelerate",
"optimize",
"ai",
"platform",
"management-api"
Expand Down
84 changes: 8 additions & 76 deletions apps/docs/content/docs/optimize/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -1,83 +1,15 @@
---
title: Getting started
description: Learn how to quickly set up and start using Prisma Optimize
title: Getting started with Optimize
description: 'Prisma Optimize has evolved into Query Insights'
url: /optimize/getting-started
metaTitle: Getting started with optimizing queries in Prisma Postgres
metaDescription: Learn how to quickly set up and start optimizing Prisma Postgres queries.
metaTitle: Getting started with Optimize → Query Insights
metaDescription: 'Prisma Optimize is now Query Insights, built into Prisma Postgres.'
---

## Prerequisites
:::warning
Prisma Optimize has evolved into **[Query Insights](/postgres/query-insights)**, now built directly into Prisma Postgres with no additional setup required.

Before you begin with Prisma Optimize, ensure you have:
Query Insights works out of the box — no API keys, extensions, or client configuration needed.

- A [Prisma Data Platform account](https://console.prisma.io/optimize?utm_source=docs&utm_medium=optimize-page)
- A project using [Prisma Client](/orm/prisma-client/setup-and-configuration/introduction)
- A PostgreSQL, MySQL/MariaDB, CockroachDB, or MS SQL Server database

:::note
Prisma Optimize is intended for use in local development environments. Learn more in the [FAQ](/optimize/more/faq).
:::

## 1. Launch Optimize

1. Log in to your [Prisma Data Platform account](https://console.prisma.io/optimize?utm_source=docs&utm_medium=optimize-page)
2. Click the **Optimize** tab in the left navigation
3. Click **Generate API key**
4. Copy the API key and save it securely
5. Click through the setup screens until you see **Finish & optimize**

## 2. Add Optimize to your application

### Install the extension

```npm
npm install @prisma/extension-optimize
```

### Add API key to `.env`

```bash
OPTIMIZE_API_KEY="YOUR_OPTIMIZE_API_KEY"
```

### Extend Prisma Client

```ts
import { PrismaClient } from "@prisma/client";
import { withOptimize } from "@prisma/extension-optimize";

const prisma = new PrismaClient().$extends(
withOptimize({ apiKey: process.env.OPTIMIZE_API_KEY })
);
```

**Using with other extensions:**

Extensions are applied sequentially. If using [Prisma Accelerate](/accelerate), apply it after Optimize:

```ts
const prisma = new PrismaClient()
.$extends(withOptimize())
.$extends(withAccelerate());
```

## 3. Generate insights

1. In the Optimize dashboard, click **Start recording**
2. Run your app and execute Prisma queries
3. Click **Stop recording** when done
4. Explore query details and check the **Recommendations** tab

:::info
Use [Prisma AI](/optimize/prisma-ai) to understand recommendations and apply them within your Prisma model context.
[Get started with Query Insights →](/postgres/query-insights)
:::

## Next steps

- [Recommendations](/optimize/recommendations) - Learn about performance recommendations
- [Recordings](/optimize/recordings) - Understand recording sessions
- [Examples](https://github.com/prisma/prisma-examples/tree/latest/optimize/starter) - Try a hands-on example

## Need help?

Reach out in the `#help-and-questions` channel on [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=generated_text_cta), or connect with [our community](https://www.prisma.io/community).
32 changes: 8 additions & 24 deletions apps/docs/content/docs/optimize/index.mdx
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
---
title: Prisma Optimize
description: 'A query performance tool for analyzing, debugging, and improving database queries during development'
description: 'Prisma Optimize has evolved into Query Insights, now built into Prisma Postgres'
url: /optimize
metaTitle: Prisma Optimize
metaDescription: Prisma Optimize is a tool that helps you generate insights on your queries and recommends performance optimizations.
metaTitle: Prisma Optimize → Query Insights
metaDescription: 'Prisma Optimize is now Query Insights, built into Prisma Postgres. No setup required.'
---

[Prisma Optimize](https://www.prisma.io/optimize) helps you generate insights and provides recommendations that can help you make your database queries faster.
:::warning
Prisma Optimize has evolved into **[Query Insights](/postgres/query-insights)**, now built directly into Prisma Postgres with no additional setup required.

## What you can do
All Optimize functionality is available through Query Insights with improvements including ORM-to-SQL attribution, AI-powered optimization prompts, and zero-configuration setup.

- **Generate insights** about your database queries
- **Identify errors** to help debug your database queries
- **Receive recommendations** with AI-powered assistance to enhance query performance

Optimize helps developers of all skill levels write efficient database queries, reducing database load and making applications more responsive.

## Supported databases

- PostgreSQL
- MySQL
- MariaDB
- CockroachDB
- MS SQL Server

## Getting started

- [Getting started](/optimize/getting-started) - Learn how to quickly set up and start using Prisma Optimize
- [Recommendations](/optimize/recommendations) - Comprehensive guide to improving database performance
- [Prisma AI](/optimize/prisma-ai) - Learn about using Optimize's Prisma AI feature
[Learn more about Query Insights →](/postgres/query-insights)
:::
39 changes: 7 additions & 32 deletions apps/docs/content/docs/optimize/more/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,38 +1,13 @@
---
title: FAQ
description: Frequently asked questions about Prisma Optimize
description: 'Prisma Optimize FAQ'
url: /optimize/more/faq
metaTitle: 'Prisma Optimize: FAQ'
metaDescription: Frequently asked questions about Prisma Optimize.
metaTitle: Optimize FAQ → Query Insights
metaDescription: 'Prisma Optimize is now Query Insights in Prisma Postgres.'
---

## Can I use Optimize in production?
:::warning
Prisma Optimize has evolved into **[Query Insights](/postgres/query-insights)**, now built directly into Prisma Postgres.

Prisma Optimize is intended for use in local development environments. It helps you analyze and optimize queries during development before deploying to production.

## What databases does Optimize support?

Optimize supports:
- PostgreSQL
- MySQL
- MariaDB
- CockroachDB
- MS SQL Server

## How many queries can I record?

Each recording session can contain up to 10,000 queries. Each workspace can have up to 100 recordings.

## Does Optimize work with Prisma Accelerate?

Yes, but you must apply the Accelerate extension after the Optimize extension:

```ts
const prisma = new PrismaClient()
.$extends(withOptimize())
.$extends(withAccelerate());
```

## Need help?

If you need assistance, reach out in the `#help-and-questions` channel on our [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=generated_text_cta), or connect with [our community](https://www.prisma.io/community) to see how others are using Optimize.
[Learn more about Query Insights →](/postgres/query-insights)
:::
54 changes: 7 additions & 47 deletions apps/docs/content/docs/optimize/more/known-limitations.mdx
Original file line number Diff line number Diff line change
@@ -1,53 +1,13 @@
---
title: Known limitations
description: Learn about known limitations of Prisma Optimize
description: 'Prisma Optimize known limitations'
url: /optimize/more/known-limitations
metaTitle: 'Optimize: Known limitations'
metaDescription: Learn about known limitations of Optimize.
metaTitle: Optimize Known Limitations → Query Insights
metaDescription: 'Prisma Optimize is now Query Insights in Prisma Postgres.'
---

Below are the known limitations when using Prisma Optimize. If you are aware of any limitations that are missing, please let us know on the `#help-and-questions` channel in our community [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=intro_text).
:::warning
Prisma Optimize has evolved into **[Query Insights](/postgres/query-insights)**, now built directly into Prisma Postgres.

## Query limit on a recording session

Each [recording session](/optimize/recordings) can contain a maximum of 10,000 queries. Once this limit is reached, the recording session will end.

## Recording limit per workspace

Each [workspace](/console/concepts#workspace) can contain a maximum of 100 [recordings](/optimize/recordings).

## Scope and constraints for Prisma AI

While [Prisma AI](/optimize/prisma-ai) can provide helpful guidance to implement a [recommendation](/optimize/recommendations), there are some important limitations to keep in mind:

- **Information and accuracy**: The AI provides advice based on a broad, general knowledge base and does not have direct access to Prisma ORM documentation. This may occasionally result in inaccuracies or outdated information.

- **Limited context and adaptation**: The AI does not persist conversations or learn from previous interactions. Its responses are generalized and may not always address the specific needs of advanced users.

- **Static knowledge and scope**: The AI's knowledge is static and may not include recent updates or best practices after a certain date. It provides advice only within the context of Prisma ORM and cannot modify or execute code, nor interact directly with user environments.

## Using Prisma Accelerate with the Optimize extension

When using the [Optimize client extension](https://www.npmjs.com/package/@prisma/extension-optimize) with the [Accelerate client extension](https://www.npmjs.com/package/@prisma/extension-accelerate), ensure the Accelerate client extension is added last to your extended `PrismaClient`. This allows cacheable operations to be received by Optimize.

```ts
const prisma = new PrismaClient()
.$extends(
withOptimize({
apiKey: process.env.OPTIMIZE_API_KEY,
}),
)
.$extends(withAccelerate());
```

## SQL references in MongoDB recommendations

Prisma Optimize provides helpful recommendations for MongoDB users, though some explanations from [Prisma AI](/optimize/prisma-ai) may reference SQL-specific concepts. However, the [recommendations](/optimize/recommendations) remain useful and applicable to MongoDB environments.

## Raw query visibility in MongoDB

Raw queries are visible in MongoDB, though the parameters passed to them are not displayed.

## Driver adapter compatibility

Prisma Optimize is not yet compatible with [driver adapters](/orm/core-concepts/supported-databases/database-drivers#driver-adapters). However, as a workaround, you can run your queries locally using the regular Prisma Client along with Prisma Optimize to inspect and improve query performance.
[Learn more about Query Insights →](/postgres/query-insights)
:::
30 changes: 8 additions & 22 deletions apps/docs/content/docs/optimize/performance-metrics.mdx
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
---
title: Performance metrics
description: Learn about the query performance metrics provided by Optimize
description: 'Prisma Optimize performance metrics are now part of Query Insights'
url: /optimize/performance-metrics
metaTitle: 'Prisma Postgres: Query performance metrics'
metaDescription: Learn about the query performance metrics provided by Optimize.
metaTitle: Optimize Performance Metrics → Query Insights
metaDescription: 'Performance metrics are now part of Query Insights in Prisma Postgres.'
---

An Optimize recording session provides detailed insights into the latencies of executed queries, capturing key metrics such as average duration, 50th percentile, 99th percentile, and maximal query execution time.
:::warning
Prisma Optimize has evolved into **[Query Insights](/postgres/query-insights)**, now built directly into Prisma Postgres.

## Total query durations
Performance metrics including execution time, read volume, and query frequency are now available through Query Insights.

Prisma Optimize measures total latency for query patterns, enabling you to analyze and debug slow queries effectively.

### Average query duration (`AVG`)

The average query duration reveals the mean execution time across all queries, helping you assess overall performance trends and identify inefficiencies that impact the user experience.

### 50th percentile (`P50`)

The 50th percentile, or median, query duration indicates the time within which half of your queries complete. This metric offers a clear view of typical user performance, unaffected by outliers.

### 99th percentile (`P99`)

The 99th percentile query duration highlights the execution time for the slowest 1% of queries. This metric is crucial for uncovering and addressing performance bottlenecks that, while infrequent, can significantly impact user satisfaction.

### Maximal query duration (`MAX`)

The maximal query duration measures the time taken by the single slowest query. This metric helps identify extreme cases, providing insights into the worst performance scenarios your system might face, so you can diagnose and resolve outliers.
[Learn more about Query Insights →](/postgres/query-insights)
:::
Loading
Loading