4

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.

user1311888
  • 773
  • 3
  • 11
  • 24

1 Answers1

7

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.

Elliott Brossard
  • 32,095
  • 2
  • 67
  • 99
  • Thanks a lot for your answer. I was looking for default wait time for timeoutMs, somehow missed it in the documentation. Thanks also for the other information about max query execution time. – user1311888 Oct 20 '16 at 19:35