diff --git a/docs/en_US/query_tool.rst b/docs/en_US/query_tool.rst index fba69a8cc8e..396c0bdb840 100644 --- a/docs/en_US/query_tool.rst +++ b/docs/en_US/query_tool.rst @@ -275,6 +275,8 @@ the drop down on the right side of *Explain Analyze* button in the toolbar. Please note that pgAdmin generates the *Explain [Analyze]* plan in JSON format. +**Note**: If multiple queries are present and none is selected, *Explain [Analyze]* runs the query located at the cursor position. + On successful generation of *Explain* plan, it will create three tabs/panels under the Explain panel. diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx index 1ebedab62a3..712803001f8 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx @@ -146,8 +146,8 @@ export default function Query({onTextSelect, setQtStatePartial}) { const regex = /\$SELECTION\$/gi; query = macroSQL.replace(regex, query); external = true; - } else if(executeCursor) { - /* Execute query at cursor position */ + } else if(executeCursor || explainObject) { + /* Execute query at cursor position or explain query at cursor position */ query = query || editor.current?.getQueryAt(editor.current?.state.selection.head).value || ''; } else { /* Normal execution */