Skip to content

Query cancellation in ClickHouse #329

Answered by DarkWanderer
ruslanen asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @ruslanen

Currently, there is no support for cancelling query on the server if cancelled on the client. This is an interesting idea to implement, but at the moment it is not there

However, if your app is 'interactive' (i.e: it is only expected to run one query at a time), a way to solve this would be to use a single instance of ClickHouseConnection with UseSession flag alongside replace_running_query setting and without custom HttpClient/HttpClientHandler. This way, the library will spawn a single HTTP connection with same lifetime as the ClickHouseConnection instance, and executing next query will cause previous one to be cancelled

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ruslanen
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants