-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Allow to wait for any asynchronous queries #23513
Description
Introduce the new WAIT-query.
Syntax:
waitStmt: WAIT (QUERY STRING_LITERAL | query);
Blocks the client until the asynchronous query is complete and returns it's result (if any). If the query is synchronous, then it's the same as just executing the query without waiting. This command doesn't allow to wait for other executing sync queries via query id, i.e. executed from different clients.
The list of all executing at the moment async queries can be issued from the system table system.asynchronous_queries with columns: query_id String - we can't show the query body to prevent security problems.
Also original query id can be obtained from the response to the client.
If there is no such query id then WAIT-query assumes that query has finished and returns immediately. Probably we can consult the query-log for the result of such query, or even for it's existance.
The examples of async queries:
- DDL queries
- ON CLUSTER queries
- queries with Distributed tables