"Explain current query" for selection

Tadas's profile image Tadas posted 7 months ago in General Permalink

It would be better to execute "Explain current query" (F9) regarding current selection. Now it always tries to explain query of whole script. So I have to mark, copy selection out of procedure script, paste it into new window and only there F9 explains it. Explain the selection, if something selected, or the whole script, if there's no selection.

ansgar's profile image ansgar posted 7 months ago Permalink

Now it always tries to explain query of whole script.

That's not true - the "Explain current query" uses the query at the cursor:

Description

Tadas's profile image Tadas posted 7 months ago Permalink

It is true. It's just different understanding, what is "query at the cursor". In fact, I was wrong about "whole script". On F9 it finds the starting point of current query back from current cursor position. And there may be no marked text selection or some text marked as selection. Both cases it finds starting point. It "create procedure " in my case. What I want is to explain the query, I selected/marked as text fragment. By the way, F10 grabs that selection properly. So I want same as F10, but explain, not execute.

ansgar's profile image ansgar posted 7 months ago Permalink

Well there is no "Explain selected code". In most cases the current query at the cursor should be what the user wants, or why do you insist on selecting the code?

Tadas's profile image Tadas posted 7 months ago Permalink

Well, I'm writting the code of procedure. I have dozen of queries inside. I can mark one and execute it with F10. And it works. But if I marked it and pressed F9, what do you think I expect as an output? Certainly not explaining the statement "create procedure". I think it would be more intuitive to estimate the presence of not empty selection in text (or marked text) and use it as desired content for execution or explanation. In fact I was a bit surprised by existance of separate shortcuts (F5 and F10) for execution. If I mark certain text and press F5, I would expect that this selection would be executed, not the whole script. I'd prefer such a behavior. But if you think that's some kind of weird request, I'm OK with that. Maybe I'm seeking for too easy living. :)

Please login to leave a reply, or register at first.