How to automatically close old query results when running new query

How can I automatically close all existing query windows when running a new query, rather than overwriting them or appending new result tabs along with the old ones?


Could you please elaborate a bit and share some screenshots? By default, DataGrip closes previously created windows and opens a new one (if the previous tab was not pinned). 


Daniil When ever i execute, it just overwrites the previous tab, not the current opening tab. How can I change this? I just want it to show the result on selecting tab. Beside, I don't use the 'Open result in new tab' option.



If you have `Open result in new` tab option unchecked, it should use the same tab for outputting result sets in the Services Window. The same goes for In-Editor view when you want your results to be shown directly in the data viewer area. Are you observing different behavior?


Forgive me if I'm understanding something incorrectly, I'm still in my trial period so I'm sure there's lots of features I'm missing, but I have the same question as Dylan and the responses so far haven't really helped me.


When I run a query that has two results:

Select * from Table1
Select * from Table2

I get 2 result tabs great!

Now I type a 3rd query (or select one of the previous), select just the one query and execute it.

Now the first tab will be overwritten with the results from the new query, but the second tab will remain open from the “Select * from table2” query. I find this pretty confusing and would like it to just close all previous results when I start a new query.

In fact, the situation becomes even more confusing (to me) when the next statement is a data modification query. At that point the query will run and te results will be shown on the Output-tab, but because all previous tabs remain it's not immediately apparent that anything happened.

If a new query execution could just close all tabs from the previous execution that'd be much better in my opinion.

Is this possible in Datagrip? It doesn't seem to be the default functionality.


Mulder closes would be to go to Setttings | Database | Query Execution and disable Open Results in new Tab 

If you want the behavior mentioned, feel free to create a new feature request on YouTrack


I've already disabled that setting and it does prevent endless tabs from being opened, but it doesn't get rid of any “excess tabs”

I'll create an issue, but t.b.h. I won't get my hopes up :)


Please sign in to leave a comment.