user1311888
user1311888

Reputation: 793

In Google BigQuery API, what is the default timeout for a query response?

In Google BigQuery API, what is the default timeout for a query response?

In other words, how long does it wait by default until the response returns null for an incomplete job.

Upvotes: 5

Views: 11635

Answers (1)

Elliott Brossard
Elliott Brossard

Reputation: 33705

The documentation for timeoutMs in the jobs.query says:

[Optional] How long to wait for the query to complete, in milliseconds, before the request times out and returns. Note that this is only a timeout for the request, not the query. If the query takes longer to run than the timeout value, the call returns without any results and with the 'jobComplete' flag set to false. You can call GetQueryResults() to wait for the query to complete and read the results. The default value is 10000 milliseconds (10 seconds).

If I understand correctly, though, I think you're asking how long a query can execute before timing out. We limit query execution to six hours (at the time of this writing), though I don't know if that's explicitly documented somewhere. In general, though, queries shouldn't take nearly that long to run.

If you want to impose a stricter timeout on query completion, you could use the jobs.cancel API after a specific amount of elapsed time, though note that you will still be charged for execution of the query.

Upvotes: 9

Related Questions