is there a way to prevent (i.e. kill) runaway queries?
i.e. set a maximum timeout after which a query will be terminated?
I assume that there is no way of knowing when the target data source (I am talking specifically about postgres is under heavy load and terminate the corresponding query causing the load?)
Yes. We do this with hosted Redash. Queries are cutoff at five minutes, two hours, or twelve hours depending on billing tier. You just add a timeout to the code that enqueues jobs.
Yes, they are totally supported in open source! I don’t have the celery code in front of me right now but here’s the relevant line on the current tip of master.