AI Assistant Help

Use AI with databases

Available in: DataGrip and IDEs with Database Tools and SQL plugin

Get AI assistance in modifying tables

You can use a natural language to ask AI Assistant to modify a database table in the Modify dialog.

  1. In Database tool window (Database Explorer in DataGrip), right-click the table that you want to modify and select Modify Table. Alternatively, select the table and press Ctrl+F6.

  2. In the Modify dialog, locate the toolbar of the table structure editor pane on the left side and click the UI AI Assistant icon AI Assistant.

  3. In the AI Assistant dialog that opens, enter your prompt and click OK.

    Prompt for modifying a table
  4. Once AI Assistant generates the SQL code for the action of your prompt, it will ask a permission to perform the action. Click Perform.

  5. Review the generated code in the preview pane.

  6. Apply the changes and close the dialog.

AI Assistant generated code for modifying a table

Explanation for query plans

IDE versions: starting from 2025.3

You can ask our AI Assistant to explain your query plans. To do this, you have to invoke the Explain Plan action on your query first.

  1. In a query console, right-click your query and go to Explain Plan | Explain Plan or Explain Plan | Explain Analyse.

    The plan appears in the Plan tab of the Services tool window.

  2. On the left toolbar of the tab, click Analyze SQL Plan with AI (experimental). AI Assistant will then provide an explanation in the chat, where you can ask any additional questions you might have about the plan.

AI Assistant explaining a query plan

Query optimization

IDE versions: starting from 2025.3

AI Assistant can now optimize your query for better performance and efficiency. It does this by:

  • Automatically detecting inefficiencies such as redundant JOIN clauses, missing indexes, or suboptimal execution plans.

  • Providing actionable suggestions or automatically rewriting queries to improve performance.

  • Leveraging Explain Plan outputs for deeper analysis and diagnostics.

This feature may require attaching the database schema to suggest proper explanations.

  • In a query console, right-click your query and select AI Actions | Optimize query with AI (experimental).

    AI Assistant gives you a list of suggestions in the chat, and you can continue to ask any questions you might have there.

    AI Assistant query optimization
02 October 2025