Yes, that would be you running an long query from a foreground script (event script, runScript() expression function, et cetera). Don't do that--it locks up the UI.
Use named query bindings. Those run the query in the background safely. Or you can learn to use invokeAsynchronous, but many people do not have the discipline to avoid interacting with UI components from the background, which has its own crash risks.
It is not fine. If a script calls a named query, the NQ runs in the script environment. Only a NQ binding runs in the background by default.
It is reasonable for a button's actionPerformed event to run a small UPDATE or INSERT query to apply a user's changes to the DB.
But that event script should NOT run the follow-up query to obtain fresh data to display. The script should use system.db.refresh() to cause a non-polling NQ binding to re-execute to get the fresh display data. Or, if the query is too complex or varied to be run from a binding, then system.util.invokeAsynchronous() should be used to run a separate function for all of that. (But obey the rules for setting the results back into the UI.)