Database Reference
In-Depth Information
More than 98 percent of BigQuery queries return in less than 3 seconds
(obviously this is highly dependent on the query being run); if you set the
timeoutMs
value to a large value, you're almost certain to get a response
without a timeout. Queries that take longer than a few seconds are generally
complicated with lots of
JOIN
or
GROUP BY
operations; simpler queries
should always complete within a reasonable timeout, unless they are
operating over truly massive amounts of data.
When
Jobs.query()
times out, it doesn't return an HTTP response error.
Instead, it returns a normal query response, but the
jobComplete
flag will
be set to
false
. It also returns a
jobId
for the Query job. You can use
this
jobId
to call
Jobs.getQueryResults()
to both wait for the job to
complete and return the results.
You might wonder why the
Jobs.query()
request is a
POST
request and
not a
GET
request. After all, a number of systems that you might want to
use to run queries support only
GET
requests, and there is a convenient
standard “
q=<url encoded query>
” syntax that you could use. One
technical issue is that
GET
requests require passing all the data in the URL,
and many web-capable systems have a limit on the length of URL they
can use in a
GET
request. Internet Explorer has a hard-limit for URLs at
approximately 2048 characters; Microsoft Excel limits URL query strings to
256 characters. Many SQL queries in BigQuery are several kilobytes long;
any system with a URL length limit would be unable to issue a considerable
proportion of BigQuery queries.