複数の BigQuery クエリジョブを並列実行する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
複数の BigQuery クエリジョブを並列で実行し、ジョブを順次実行した場合と比べてパフォーマンスが向上していることを示します。
もっと見る
このコードサンプルを含む詳細なドキュメントについては、以下をご覧ください。
コードサンプル
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],[],[],[],null,["# Run multiple BigQuery query jobs in parallel\n\nRuns multiple BigQuery query jobs in parallel, demonstrating an improvement in performance when compared to running the jobs serially, one after the other.\n\nExplore further\n---------------\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Run multiple BigQuery jobs in parallel](/workflows/docs/tutorials/bigquery-parallel-jobs)\n\nCode sample\n-----------\n\n### YAML\n\n main:\n steps:\n - init:\n assign:\n - results : {} # result from each iteration keyed by table name\n - tables:\n - 201201h\n - 201202h\n - 201203h\n - 201204h\n - 201205h\n - runQueries:\n parallel:\n shared: [results]\n for:\n value: table\n in: ${tables}\n steps:\n - logTable:\n call: sys.log\n args:\n text: ${\"Running query for table \" + table}\n - runQuery:\n call: googleapis.bigquery.v2.jobs.query\n args:\n projectId: ${sys.get_env(\"GOOGLE_CLOUD_PROJECT_ID\")}\n body:\n useLegacySql: false\n useQueryCache: false\n timeoutMs: 30000\n # Find top 100 titles with most views on Wikipedia\n query: ${\n \"SELECT TITLE, SUM(views)\n FROM `bigquery-samples.wikipedia_pageviews.\" + table + \"`\n WHERE LENGTH(TITLE) \u003e 10\n GROUP BY TITLE\n ORDER BY SUM(VIEWS) DESC\n LIMIT 100\"\n }\n result: queryResult\n - returnResult:\n assign:\n # Return the top title from each table\n - results[table]: {}\n - results[table].title: ${queryResult.rows[0].f[0].v}\n - results[table].views: ${queryResult.rows[0].f[1].v}\n - returnResults:\n return: ${results}\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=workflows)."]]