I don't have the same situation as you but generally when I am faced with a situation like this I often end up doing two high focus things one after another.
So when your query is running for 5 mins you can switch to something of a similar nature (another query perhaps?).