Batch exports can be cancelled or fail for whatever reason, even reasons beyond query execution. In those cases, we should make sure we at least attempt to cancel queries on ClickHouse's side to avoid overloading the cluster if we continuously fail and retry the same heavy queries.
Changes
Enable setting cancel_http_readonly_queries_on_client_close. Since all batch export queries are just a SELECT this should take care of cancelling them once we disconnect the client.
Problem
Batch exports can be cancelled or fail for whatever reason, even reasons beyond query execution. In those cases, we should make sure we at least attempt to cancel queries on ClickHouse's side to avoid overloading the cluster if we continuously fail and retry the same heavy queries.
Changes
Enable setting
cancel_http_readonly_queries_on_client_close
. Since all batch export queries are just aSELECT
this should take care of cancelling them once we disconnect the client.👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Does this work well for both Cloud and self-hosted?
How did you test this code?