使用Node Api运行的查询比在GUI中运行的同一查询慢约25倍。我错过了什么吗?我在Node中使用.query()
函数。例如,在GUI上运行此查询大约需要13秒。
#standardSQL
SELECT
repository.url,
repository.has_downloads
FROM
`bigquery-public-data.samples.github_nested`
此查询返回250万行。等效的Node代码大约需要336秒,看起来像这样;
const BigQuery = require("@google-cloud/bigquery")
const query = `
SELECT
repository.url,
repository.has_downloads
FROM \`bigquery-public-data.samples.github_nested\``
new BigQuery({
projectId: "project-id",
})
.query({
query: query,
useLegacySql: false,
})
.then(console.log)
.catch(console.error)