Screens: AI, MCP and security

AI in the editor and ERD

The SQL editor and the ERD have menus that hand the SQL or table you are looking at straight to the AI. Clicking one opens the AI Assistant panel on the right and prepares a request with that target attached. You receive the answer and SQL cards in the same panel as an ordinary chat.

Where you can use itWebDesktopWithout signing inSigned inLocal projectsAccount projects

What's on the screen

No.NameDescription
1AttachmentThe target you handed over. Query tuning attaches it as SQL for Query Tuning, sample data as Tables to Populate with Sample Data, and SQL error questions as SQL Error to Diagnose. The attachment is the request itself, so you do not type anything.
2Tool activityRecords of the AI checking the target's table details and execution plan.
3ExplanationThe diagnosis and its evidence. Query tuning answers in the order diagnosis summary, improved SQL, index recommendations, then other optimizations and assumptions.
4Improved SQL cardThe rewritten SELECT. A SELECT runs as soon as the response ends and gets a result.
5Index cardA CREATE INDEX proposal. It is a schema change, so while the Schema changes option is off (the default) it does not run and waits.

There are three kinds of work you can hand over.

WorkWhere to start itWhen it is sentTools the AI uses
Query tuningThe AI: Tune query item in the SQL editor's right-click menuRight awayTable details, execution plan and, if needed, real data queries
SQL error questionThe AI button next to an SQL error, or the AI: Ask about SQL Error item when you right-click the errorRight awayTable details only
Sample dataThe ERD table context menuAI: Generate Sample Data item when you right-click an ERD tableWhen you set the row count and click the Send buttonTable details and real data queries
  • The target's connection must have its Enabled option on in Project AI settings, and you need a usable API key. Otherwise a notification tells you why when you click the menu.
  • You cannot use these menus while another AI response is coming in.
  • The work continues the chat that is currently open. Query tuning and sample data add the target's schema to the context; an SQL error question replaces the context with the error's target. The target's schema carries a lock and cannot be removed.

Query tuning

  1. In an SQL tab, put the cursor in the statement to tune, or select that part.
  2. Right-click the editor and click the AI: Tune query item.
  3. The panel opens and the statement is attached (1) and sent right away. The AI checks the table details and the estimated execution plan (2) and then answers.
  4. Compare the result of the improved SQL card (4) with the original query. Review the index card (5) and run it with the Run button, or move it to the editor with the Open editor button and edit it.
  • What is sent is the statement's SQL with comments removed, plus the tab's connection, database, schema. The original SQL tab is not changed.
  • NeoSQL instructs the AI not to run the original or rewritten query and to judge only from the estimated plan from EXPLAIN. It also instructs the AI not to claim actual run times or improvements and to mark every proposal as unverified.
  • On SQLite the AI cannot see an execution plan, so it diagnoses from table details only. How each DBMS provides a plan is explained in Execution plan.
  • Proposals such as refreshing statistics, partitioning or configuration changes are to be given as explanation only; the AI is instructed to give executable SQL cards only for the rewritten query and CREATE INDEX.

SQL error questions

When running SQL fails, an AI button appears at the right of the error message. The same button appears in the result area and execution plan of an SQL tab, the data area of table and object tabs, the error window of the Run Script command, and the detail window of the SQL history.

  1. Click the AI button (1) at the right of the error message. You can also right-click the error and click the AI: Ask about SQL Error item (2).
  2. The panel opens with the SQL, SQLSTATE and Error message sections attached, and sends them right away.
  3. The AI explains the cause and how to fix it, and gives corrected SQL as a card when it has the evidence.
  • For this request the only tool the AI gets is table details. It gets no real data query or execution plan tool, so no data values go to the AI provider.
  • The context changes to the AI-enabled schemas of the connection where the error happened. If the error happened in a specific schema, only that schema is used.
  • Errors from SQL that contains credentials, such as a password or IDENTIFIED BY, are not sent to the AI. The AI button cannot be clicked.
  • The Copy error message, Copy SQL and Copy all items in the same right-click menu copy to the clipboard without AI.

Making sample data

The AI writes plausible data for an ERD table as INSERT statements.

  1. Right-click a table in the ERD and click the ERD table context menuAI: Generate Sample Data item.
  2. The target table (1) is attached to the panel's input area, and the row count field (2) appears. It starts at 20 rows.
  3. Set the row count and click the Send button (3).
  4. The AI checks columns, keys and constraints, queries actual parent key values for foreign keys and duplicates of primary and unique keys, and then gives INSERT cards.
  5. Review the cards and click the Run button. It is a data change, so a confirmation window appears.
  • Only the table you right-clicked is the target. Even if you select several tables and right-click, only the right-clicked one is used.
  • It only works for ordinary tables that exist in the real database. For a new table that exists only in the ERD, clicking the menu shows a notice to apply it to the database first. Views, deleted tables and tables without a connection do not show the menu.
  • NeoSQL instructs the AI to leave auto-increment and generated columns out of the INSERT, and to explain instead of giving SQL when the constraints cannot be met. Still check the result before running it.
  • The queries for parent keys and duplicates send real data to the AI provider. If the connection's Allow data transfer option is off, an approval card appears for each query.
  • The duplicate check reflects the moment of the query. If someone inserts the same key before you run it, the run can fail.
  • With a large row count, the response can be cut off by the key's Max output tokens. If you need many rows, make them in several rounds.

Things to keep in mind

  • With query tuning and SQL error questions, the SQL goes to the AI provider the moment you click the menu. Remove personal data from literals in the SQL before handing it over.
  • The improved SQL from query tuning is a SELECT, so it runs on the database as soon as the response ends. Tune heavy queries on a connection that is not a production database.
  • AI tuning proposals are based on the estimated plan. Check them against real data and load before creating indexes.
  • Sample data INSERT statements are committed as soon as they run. Do not run them on a production database.
  • Executed SQL is kept in the SQL history and saved SQL as run by the AI.
  • AI Assistant: the panel that receives the answers and SQL cards for the work you hand over.
  • Project AI settings: set automatic execution and data transfer approval per connection.
  • SQL editor: the editor with the query tuning menu.
  • Execution plan: view the estimated execution plan the AI uses for tuning yourself.
  • ERD canvas: the table right-click menu with the sample data item.
  • Apply changes to the database: create tables that exist only in the ERD in the database before adding sample data.