-
Notifications
You must be signed in to change notification settings - Fork 914
docs: replace Optimize with Query Insights #7611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AmanVarshney01
wants to merge
5
commits into
main
Choose a base branch
from
docs/replace-optimize-with-query-insights
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2d51922
docs: replace Optimize with Query Insights across v7 docs
AmanVarshney01 b0ccc52
docs: remove v6 Optimize content and redirect to Query Insights
AmanVarshney01 62543bb
docs: remove v7 Optimize content and redirect to Query Insights
AmanVarshney01 2c00c0f
Merge remote-tracking branch 'origin/main' into docs/replace-optimize…
AmanVarshney01 aac5dcf
remove query insights
AmanVarshney01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
| "title": "Features", | ||
| "pages": [ | ||
| "metrics", | ||
| "optimize", | ||
| "api-keys" | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| ::: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ | |
| "guides", | ||
| "studio", | ||
| "accelerate", | ||
| "optimize", | ||
| "ai", | ||
| "platform", | ||
| "management-api" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| ::: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
54
apps/docs/content/docs/optimize/more/known-limitations.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| ::: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| ::: |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
📝 Committable suggestion
🤖 Prompt for AI Agents