From 37e4469aceef49f4277b2e7884819d757cb0b99d Mon Sep 17 00:00:00 2001 From: Dorota Wojcik Date: Wed, 18 Mar 2026 09:41:56 +0100 Subject: [PATCH 01/10] pg studio ask ai --- docs/products/postgresql/howto/pg-studio.md | 44 ++++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/docs/products/postgresql/howto/pg-studio.md b/docs/products/postgresql/howto/pg-studio.md index 4af3a5763..9c5a67f41 100644 --- a/docs/products/postgresql/howto/pg-studio.md +++ b/docs/products/postgresql/howto/pg-studio.md @@ -50,6 +50,22 @@ When you enter a prompt: You can also ask the assistant to describe table relationships or break down complex queries. +### Use Ask AI + +The Ask AI capability in the AI Assistant panel lets you get help with SQL queries +and database questions in natural language. You can: + +- **Generate queries:** Describe what data you need, and the assistant creates the SQL + query for you. +- **Get explanations:** Ask about SQL syntax, query structure, or how specific database + features work. +- **Understand your schema:** Request information about table structures, relationships, + and data organization. +- **Troubleshoot queries:** Get help debugging errors or improving query performance. + +The AI Assistant uses your database schema as context for all responses, providing +accurate and relevant suggestions specific to your data structure. + ### Query execution When you run a query, whether generated by the AI or written manually: @@ -129,6 +145,9 @@ This is useful for: 1. Review the generated SQL in the SQL editor. 1. Click **Run** to execute the query. +You can use Ask AI to describe your needs in plain language. The assistant interprets +your request and generates appropriate SQL based on your database schema. + Example queries to try: - Show monthly active users for the last 6 months @@ -137,18 +156,39 @@ Example queries to try: - Find duplicate email addresses in the users table - List failed payment transactions from the last week with customer details +You can also Ask AI questions about your database structure: + +- What columns are in the users table? +- How are the orders and customers tables related? +- What data types are used in the products table? + ### Ask for explanations -Use the AI Assistant panel to explain queries, break down joins and filters, and -describe table relationships. +Use Ask AI in the AI Assistant panel to explain queries, break down joins and filters, +and describe table relationships. 1. Paste a query into the SQL editor. 1. In the AI Assistant panel, request an explanation. 1. Review the explanation of tables, joins, filters, and logic. +You can Ask AI to: + +- Explain what a specific SQL query does in plain language +- Break down complex queries into simpler steps +- Describe how JOIN operations combine data from multiple tables +- Clarify the purpose of WHERE clauses and filters +- Explain aggregate functions and GROUP BY operations + ### Explore your schema 1. Ask a schema question in the AI Assistant panel, such as how tables relate or what a column stores. 1. Review the response or generated SQL. 1. Click **Open schema map** to browse tables and relationships visually. + +Use Ask AI to understand your database structure: + +- Ask about table relationships and foreign key connections +- Get descriptions of column purposes and data types +- Learn about indexes and constraints +- Understand the overall structure of your database schema From 9398de44696f24789749f19b22cdf1448e0e681f Mon Sep 17 00:00:00 2001 From: Dorota Wojcik Date: Wed, 18 Mar 2026 10:02:02 +0100 Subject: [PATCH 02/10] updates --- docs/products/postgresql/howto/pg-studio.md | 26 +++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/products/postgresql/howto/pg-studio.md b/docs/products/postgresql/howto/pg-studio.md index 9c5a67f41..5289da5b8 100644 --- a/docs/products/postgresql/howto/pg-studio.md +++ b/docs/products/postgresql/howto/pg-studio.md @@ -50,9 +50,9 @@ When you enter a prompt: You can also ask the assistant to describe table relationships or break down complex queries. -### Use Ask AI +### Use **Ask AI** -The Ask AI capability in the AI Assistant panel lets you get help with SQL queries +The **Ask AI** capability in the AI Assistant panel lets you get help with SQL queries and database questions in natural language. You can: - **Generate queries:** Describe what data you need, and the assistant creates the SQL @@ -66,6 +66,16 @@ and database questions in natural language. You can: The AI Assistant uses your database schema as context for all responses, providing accurate and relevant suggestions specific to your data structure. +When you work in the SQL editor, you can also click **Ask AI** in the floating +statement actions next to **Run selected**. PG Studio opens the AI Assistant panel, +attaches SQL context, and focuses the input. + +PG Studio sends SQL context in two parts: + +- The full active SQL statement for complete context, including aliases, CTEs, + and joins. +- Any highlighted SQL snippet as a separate focus area. + ### Query execution When you run a query, whether generated by the AI or written manually: @@ -145,7 +155,7 @@ This is useful for: 1. Review the generated SQL in the SQL editor. 1. Click **Run** to execute the query. -You can use Ask AI to describe your needs in plain language. The assistant interprets +You can use **Ask AI** to describe your needs in plain language. The assistant interprets your request and generates appropriate SQL based on your database schema. Example queries to try: @@ -156,7 +166,7 @@ Example queries to try: - Find duplicate email addresses in the users table - List failed payment transactions from the last week with customer details -You can also Ask AI questions about your database structure: +You can also **Ask AI** questions about your database structure: - What columns are in the users table? - How are the orders and customers tables related? @@ -164,14 +174,16 @@ You can also Ask AI questions about your database structure: ### Ask for explanations -Use Ask AI in the AI Assistant panel to explain queries, break down joins and filters, +Use **Ask AI** in the AI Assistant panel to explain queries, break down joins and filters, and describe table relationships. 1. Paste a query into the SQL editor. +1. Optional: Highlight the part of the query to focus on. +1. Click **Ask AI** next to **Run selected**. 1. In the AI Assistant panel, request an explanation. 1. Review the explanation of tables, joins, filters, and logic. -You can Ask AI to: +You can **Ask AI** to: - Explain what a specific SQL query does in plain language - Break down complex queries into simpler steps @@ -186,7 +198,7 @@ You can Ask AI to: 1. Review the response or generated SQL. 1. Click **Open schema map** to browse tables and relationships visually. -Use Ask AI to understand your database structure: +Use **Ask AI** to understand your database structure: - Ask about table relationships and foreign key connections - Get descriptions of column purposes and data types From 33dd2e1ba37dc74afd00c4fc11ce0c0c0ed37811 Mon Sep 17 00:00:00 2001 From: Dorota Wojcik Date: Wed, 18 Mar 2026 10:06:23 +0100 Subject: [PATCH 03/10] updates --- docs/products/postgresql/howto/pg-studio.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/docs/products/postgresql/howto/pg-studio.md b/docs/products/postgresql/howto/pg-studio.md index 5289da5b8..c8bd65183 100644 --- a/docs/products/postgresql/howto/pg-studio.md +++ b/docs/products/postgresql/howto/pg-studio.md @@ -155,9 +155,6 @@ This is useful for: 1. Review the generated SQL in the SQL editor. 1. Click **Run** to execute the query. -You can use **Ask AI** to describe your needs in plain language. The assistant interprets -your request and generates appropriate SQL based on your database schema. - Example queries to try: - Show monthly active users for the last 6 months @@ -166,12 +163,6 @@ Example queries to try: - Find duplicate email addresses in the users table - List failed payment transactions from the last week with customer details -You can also **Ask AI** questions about your database structure: - -- What columns are in the users table? -- How are the orders and customers tables related? -- What data types are used in the products table? - ### Ask for explanations Use **Ask AI** in the AI Assistant panel to explain queries, break down joins and filters, @@ -197,10 +188,3 @@ You can **Ask AI** to: column stores. 1. Review the response or generated SQL. 1. Click **Open schema map** to browse tables and relationships visually. - -Use **Ask AI** to understand your database structure: - -- Ask about table relationships and foreign key connections -- Get descriptions of column purposes and data types -- Learn about indexes and constraints -- Understand the overall structure of your database schema From 2e24d53ede51314e2f64cc1902daba7fbae5867a Mon Sep 17 00:00:00 2001 From: Dorota Wojcik Date: Wed, 18 Mar 2026 10:35:09 +0100 Subject: [PATCH 04/10] updates --- .../config/vocabularies/Aiven/accept.txt | 2 ++ docs/products/postgresql/howto/pg-studio.md | 30 ++++++------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/vale/styles/config/vocabularies/Aiven/accept.txt b/.github/vale/styles/config/vocabularies/Aiven/accept.txt index 3d9056ead..e0c287584 100644 --- a/.github/vale/styles/config/vocabularies/Aiven/accept.txt +++ b/.github/vale/styles/config/vocabularies/Aiven/accept.txt @@ -67,6 +67,8 @@ CPU/MS CPUs? cqlsh CRD +CTE +CTEs cron cutover Cutover diff --git a/docs/products/postgresql/howto/pg-studio.md b/docs/products/postgresql/howto/pg-studio.md index c8bd65183..1847dd702 100644 --- a/docs/products/postgresql/howto/pg-studio.md +++ b/docs/products/postgresql/howto/pg-studio.md @@ -38,22 +38,10 @@ PG Studio supports: You can work by typing SQL directly or by prompting the AI Assistant. -### Generate SQL with the AI Assistant +### How AI assistance works -When you enter a prompt: - -- PG Studio provides the assistant with your schema, including tables, columns and - relationships. -- The assistant generates SQL or an explanation. -- The SQL appears in the editor for review before you run it. - -You can also ask the assistant to describe table relationships or break down complex -queries. - -### Use **Ask AI** - -The **Ask AI** capability in the AI Assistant panel lets you get help with SQL queries -and database questions in natural language. You can: +The AI Assistant lets you get help with SQL queries and database questions in natural +language. You can: - **Generate queries:** Describe what data you need, and the assistant creates the SQL query for you. @@ -61,22 +49,22 @@ and database questions in natural language. You can: features work. - **Understand your schema:** Request information about table structures, relationships, and data organization. -- **Troubleshoot queries:** Get help debugging errors or improving query performance. +- **Troubleshoot queries:** Get help debugging errors, breaking down complex queries, or + improving query performance. The AI Assistant uses your database schema as context for all responses, providing accurate and relevant suggestions specific to your data structure. When you work in the SQL editor, you can also click **Ask AI** in the floating -statement actions next to **Run selected**. PG Studio opens the AI Assistant panel, +statement actions next to **Run selected**. PG Studio opens the **AI Assistant** panel, attaches SQL context, and focuses the input. PG Studio sends SQL context in two parts: -- The full active SQL statement for complete context, including aliases, CTEs, - and joins. +- The full active SQL statement for context, including aliases, CTEs, and joins. - Any highlighted SQL snippet as a separate focus area. -### Query execution +### Executing queries When you run a query, whether generated by the AI or written manually: @@ -145,7 +133,7 @@ It runs the query where your cursor is placed. This is useful for: - Testing individual queries from a larger script -- Iterating quickly on a single query while keeping other statements in context +- Iterating on a single query while keeping other statements in context - Testing each subquery independently before combining a complex query - Verifying data in a specific table without executing setup or cleanup statements From 34c1a2586aef6ae6391b9823a1ed9267280b6d39 Mon Sep 17 00:00:00 2001 From: Dorota Wojcik Date: Wed, 18 Mar 2026 11:29:17 +0100 Subject: [PATCH 05/10] feedback --- docs/products/postgresql/howto/pg-studio.md | 24 +++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/products/postgresql/howto/pg-studio.md b/docs/products/postgresql/howto/pg-studio.md index 1847dd702..ce1d69b49 100644 --- a/docs/products/postgresql/howto/pg-studio.md +++ b/docs/products/postgresql/howto/pg-studio.md @@ -28,7 +28,7 @@ PG Studio supports: - **Schema visualization:** View your database structure as an interactive diagram showing tables, columns and relationships. Open it from **Open schema map** or request - it from the AI Assistant panel. + it from the **AI Assistant** panel. - **SQL editor:** Write and edit SQL across multiple tabs, and run queries to view results in the results panel. - **AI Assistant panel:** Describe what you need in natural language. The assistant @@ -96,7 +96,7 @@ To open PG Studio: 1. Click . 1. Select the source database and schema. -PG Studio opens a split view with a SQL editor on the left and the AI Assistant +PG Studio opens a split view with a SQL editor on the left and the **AI Assistant** panel on the right. Use the selectors at the top of the editor to switch the database source and schema. @@ -139,7 +139,7 @@ This is useful for: ### Generate SQL with natural language -1. In the AI Assistant panel, describe the query or result you need. +1. In the **AI Assistant** panel, describe the query or result you need. 1. Review the generated SQL in the SQL editor. 1. Click **Run** to execute the query. @@ -151,16 +151,20 @@ Example queries to try: - Find duplicate email addresses in the users table - List failed payment transactions from the last week with customer details -### Ask for explanations +### Ask AI about your query -Use **Ask AI** in the AI Assistant panel to explain queries, break down joins and filters, -and describe table relationships. +Use **Ask AI** in the **AI Assistant** panel to explain queries or get a modified version +of a highlighted SQL snippet. 1. Paste a query into the SQL editor. 1. Optional: Highlight the part of the query to focus on. 1. Click **Ask AI** next to **Run selected**. -1. In the AI Assistant panel, request an explanation. -1. Review the explanation of tables, joins, filters, and logic. +1. In the **AI Assistant** panel, enter your request. +1. Review the explanation or updated SQL in the editor. + +When you highlight a snippet, the AI uses it as a focused context. You can ask for +an explanation of that part or request changes to it, such as rewriting a filter +or optimizing a subquery. You can **Ask AI** to: @@ -169,10 +173,12 @@ You can **Ask AI** to: - Describe how JOIN operations combine data from multiple tables - Clarify the purpose of WHERE clauses and filters - Explain aggregate functions and GROUP BY operations +- Rewrite or modify a highlighted part of a query +- Optimize a selected subquery or filter condition ### Explore your schema -1. Ask a schema question in the AI Assistant panel, such as how tables relate or what a +1. Ask a schema question in the **AI Assistant** panel, such as how tables relate or what a column stores. 1. Review the response or generated SQL. 1. Click **Open schema map** to browse tables and relationships visually. From f5e5efe8fcbefed18cc94502c9ef52936b1ace9e Mon Sep 17 00:00:00 2001 From: dorota <114921900+wojcik-dorota@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:07:41 +0100 Subject: [PATCH 06/10] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: dorota <114921900+wojcik-dorota@users.noreply.github.com> --- docs/products/postgresql/howto/pg-studio.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/products/postgresql/howto/pg-studio.md b/docs/products/postgresql/howto/pg-studio.md index ce1d69b49..6cf565fea 100644 --- a/docs/products/postgresql/howto/pg-studio.md +++ b/docs/products/postgresql/howto/pg-studio.md @@ -55,10 +55,8 @@ language. You can: The AI Assistant uses your database schema as context for all responses, providing accurate and relevant suggestions specific to your data structure. -When you work in the SQL editor, you can also click **Ask AI** in the floating -statement actions next to **Run selected**. PG Studio opens the **AI Assistant** panel, +When you work in the SQL editor, click **Ask AI** for the current statement. PG Studio opens the **AI Assistant** panel, attaches SQL context, and focuses the input. - PG Studio sends SQL context in two parts: - The full active SQL statement for context, including aliases, CTEs, and joins. @@ -153,12 +151,11 @@ Example queries to try: ### Ask AI about your query -Use **Ask AI** in the **AI Assistant** panel to explain queries or get a modified version -of a highlighted SQL snippet. +Use **Ask AI** next to **Run selected** in the SQL editor to explain queries or get a modified version of a highlighted SQL snippet in the **AI Assistant** panel. 1. Paste a query into the SQL editor. 1. Optional: Highlight the part of the query to focus on. -1. Click **Ask AI** next to **Run selected**. +1. Click **Ask AI** in the SQL editor. 1. In the **AI Assistant** panel, enter your request. 1. Review the explanation or updated SQL in the editor. From eaa25b83c6dad1c482fb36adfc1d3c3f1f003c4f Mon Sep 17 00:00:00 2001 From: dorota <114921900+wojcik-dorota@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:14:31 +0100 Subject: [PATCH 07/10] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: dorota <114921900+wojcik-dorota@users.noreply.github.com> --- docs/products/postgresql/howto/pg-studio.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/products/postgresql/howto/pg-studio.md b/docs/products/postgresql/howto/pg-studio.md index 6cf565fea..d2ba0a5a8 100644 --- a/docs/products/postgresql/howto/pg-studio.md +++ b/docs/products/postgresql/howto/pg-studio.md @@ -94,10 +94,8 @@ To open PG Studio: 1. Click . 1. Select the source database and schema. -PG Studio opens a split view with a SQL editor on the left and the **AI Assistant** -panel on the right. Use the selectors at the top of the editor to switch the database -source and schema. - +PG Studio opens a split view that shows the SQL editor and the **AI Assistant** +panel. Use the editor selectors to change the database source and schema. ### Write SQL manually 1. In the SQL editor, enter your query. @@ -151,7 +149,7 @@ Example queries to try: ### Ask AI about your query -Use **Ask AI** next to **Run selected** in the SQL editor to explain queries or get a modified version of a highlighted SQL snippet in the **AI Assistant** panel. +Use **Ask AI** in the SQL editor to explain queries. It can also create a modified version of a highlighted SQL snippet in the **AI Assistant** panel. 1. Paste a query into the SQL editor. 1. Optional: Highlight the part of the query to focus on. From f78d8c249110b9eb74670143e2e9ba7b51b5206c Mon Sep 17 00:00:00 2001 From: dorota <114921900+wojcik-dorota@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:23:46 +0100 Subject: [PATCH 08/10] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: dorota <114921900+wojcik-dorota@users.noreply.github.com> --- docs/products/postgresql/howto/pg-studio.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/products/postgresql/howto/pg-studio.md b/docs/products/postgresql/howto/pg-studio.md index d2ba0a5a8..c2e128ece 100644 --- a/docs/products/postgresql/howto/pg-studio.md +++ b/docs/products/postgresql/howto/pg-studio.md @@ -59,7 +59,7 @@ When you work in the SQL editor, click **Ask AI** for the current statement. PG attaches SQL context, and focuses the input. PG Studio sends SQL context in two parts: -- The full active SQL statement for context, including aliases, CTEs, and joins. +- The full active SQL statement for context, including aliases, common table expressions (CTEs), and joins. - Any highlighted SQL snippet as a separate focus area. ### Executing queries @@ -165,9 +165,9 @@ You can **Ask AI** to: - Explain what a specific SQL query does in plain language - Break down complex queries into simpler steps -- Describe how JOIN operations combine data from multiple tables -- Clarify the purpose of WHERE clauses and filters -- Explain aggregate functions and GROUP BY operations +- Describe how `JOIN` operations combine data from multiple tables +- Clarify the purpose of `WHERE` clauses and filters +- Explain aggregate functions and `GROUP BY` operations - Rewrite or modify a highlighted part of a query - Optimize a selected subquery or filter condition From 6b201a05288e5d0ea3cb453ac8ed66160eb39830 Mon Sep 17 00:00:00 2001 From: dorota <114921900+wojcik-dorota@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:24:08 +0100 Subject: [PATCH 09/10] Update pg-studio.md Signed-off-by: dorota <114921900+wojcik-dorota@users.noreply.github.com> --- docs/products/postgresql/howto/pg-studio.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/products/postgresql/howto/pg-studio.md b/docs/products/postgresql/howto/pg-studio.md index c2e128ece..8c8e3044c 100644 --- a/docs/products/postgresql/howto/pg-studio.md +++ b/docs/products/postgresql/howto/pg-studio.md @@ -96,6 +96,7 @@ To open PG Studio: PG Studio opens a split view that shows the SQL editor and the **AI Assistant** panel. Use the editor selectors to change the database source and schema. + ### Write SQL manually 1. In the SQL editor, enter your query. From f0937a3952ed534f7d6e1621d6fb852fc2c07b88 Mon Sep 17 00:00:00 2001 From: Dorota Wojcik Date: Fri, 20 Mar 2026 17:46:29 +0100 Subject: [PATCH 10/10] fix --- docs/products/postgresql/howto/pg-studio.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/products/postgresql/howto/pg-studio.md b/docs/products/postgresql/howto/pg-studio.md index 8c8e3044c..7fe6279c1 100644 --- a/docs/products/postgresql/howto/pg-studio.md +++ b/docs/products/postgresql/howto/pg-studio.md @@ -55,11 +55,12 @@ language. You can: The AI Assistant uses your database schema as context for all responses, providing accurate and relevant suggestions specific to your data structure. -When you work in the SQL editor, click **Ask AI** for the current statement. PG Studio opens the **AI Assistant** panel, -attaches SQL context, and focuses the input. +When you work in the SQL editor, click **Ask AI** for the current statement. PG Studio +opens the **AI Assistant** panel, attaches SQL context, and focuses the input. PG Studio sends SQL context in two parts: -- The full active SQL statement for context, including aliases, common table expressions (CTEs), and joins. +- The full active SQL statement for context, including aliases, common table expressions + (CTEs), and joins. - Any highlighted SQL snippet as a separate focus area. ### Executing queries @@ -150,13 +151,16 @@ Example queries to try: ### Ask AI about your query -Use **Ask AI** in the SQL editor to explain queries. It can also create a modified version of a highlighted SQL snippet in the **AI Assistant** panel. +Use **Ask AI** in the SQL editor to explain queries or create a modified version of your +SQL. The AI response and any updated SQL appear in the **AI Assistant** panel. 1. Paste a query into the SQL editor. 1. Optional: Highlight the part of the query to focus on. 1. Click **Ask AI** in the SQL editor. 1. In the **AI Assistant** panel, enter your request. -1. Review the explanation or updated SQL in the editor. +1. Review the explanation or updated SQL in the **AI Assistant** panel. +1. Optional: Click **Run query** in the **AI Assistant** panel to move the updated SQL to + the editor and execute it. When you highlight a snippet, the AI uses it as a focused context. You can ask for an explanation of that part or request changes to it, such as rewriting a filter @@ -174,7 +178,7 @@ You can **Ask AI** to: ### Explore your schema -1. Ask a schema question in the **AI Assistant** panel, such as how tables relate or what a - column stores. +1. Ask a schema question in the **AI Assistant** panel, such as how tables relate or what + a column stores. 1. Review the response or generated SQL. 1. Click **Open schema map** to browse tables and relationships visually.