koszti edited a comment on pull request #15403: URL: https://github.com/apache/superset/pull/15403#issuecomment-875164775
>Huh, I'm pretty sure the stop button used to work with Hive/Presto, killing the query. @betodealmeida I think you're right. Hive and presto drivers are running queries in async mode with custom cursor handlers. They periodically selects the query status from the superset db in every second and if the query status is `STOPPED` then it cancels the query by calling the `cursor.cancel()` function. Hive [here](https://github.com/apache/superset/blob/master/superset/db_engine_specs/hive.py#L331), Presto [here](https://github.com/apache/superset/blob/master/superset/db_engine_specs/presto.py#L965). This method unfortunately is not necessarily working for other db engines. Mysql, postgres and snowflake for example are running queries in sync mode where polling is not available so we can't check periodically the query status from the superset database. In case of mysql, postgres and snowflake, pressing the stop button sends a message to the corresponding `db_engine_spec` to cancel the query by calling DB specific kill commands. The behaviour of Db engines that doesn't implement the [cancel_query](https://github.com/apache/superset/blob/cda7c0e547493569f829731b810e8b6bd07620be/superset/db_engine_specs/base.py#L1319) method remains the same, so no changes in hive and presto queries. They're still running in async mode, polling query statuses and terminating queries by `cursor.cancel()` whenever the stop button pressed. --- > I'm not sure if navigating to another page should cancel the query - I can see wanting to navigate away from a long running query and coming back to it. @yousoph you can still keep running the long queries by not closing the browser tab. This is a very similar behaviour when running queries in a desktop SQL client. If we close a desktop SQL client then the running queries are terminated. I believe that SQL Lab should behave the same and running queries need to be terminated when navigating to another window or when closing the browser. This is a default behaviour in Looker (and maybe in Tableau?) as well. --- **A bit more context about this PR**: We're about to give SQL Lab access to 2000 registered users and expecting about 100 concurrent users in every hour. Manual queries accidentally will be be self joins, cross joins, ones with missing WHERE conditions or simple very long running queries. People will press the stop button or close the browser windows in the hope their queries got killed to let other people to run queries. In concurrency sensitive databases (like snowflake or redshift), stuck queries blocking people to run new queries and features like this PR is crucial. Please let me know your thougs. :bowing_man: -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
