use*_*672 3 caching google-bigquery
我正在使用 bigquery 命令行工具。如何通过 BigQuery 命令行工具启用缓存。
查询会自动缓存,但以下情况除外:
您可以通过从查询中查找作业对象来看到这一点。例如:
$ bq query select 17
Waiting on bqjob_r4c80a6944b4dff0_0000014165a4f730_1 ... (0s) Current status: DONE
+-----+
| f0_ |
+-----+
| 17 |
+-----+
Run Code Online (Sandbox Code Playgroud)
这实际上运行了查询并将其添加到缓存中。现在让我们再次运行它:
$ bq query select 17
Waiting on bqjob_r27fa3d897b8dfb3e_0000014165a66b50_1 ... (0s) Current status: DONE
+-----+
| f0_ |
+-----+
| 17 |
+-----+
Run Code Online (Sandbox Code Playgroud)
该查询结果应该是从缓存中获取的。这将在作业资源的 stats.query.cacheHit 成员中可见。让我们检查:
$ bq --format=prettyjson show -j bqjob_r27fa3d897b8dfb3e_0000014165a66b50_1
{
"configuration": {
"query": {
...
"query": "select 17",
}
},
...
"statistics": {
"creationTime": "1380389907722",
"endTime": "1380389908018",
"query": {
"cacheHit": true,
"totalBytesProcessed": "0"
},
"startTime": "1380389907853",
},
}
Run Code Online (Sandbox Code Playgroud)