Google BigQueryが分散データ向けクロスリージョンSQLクエリをプレビュー
Google Cloudは、異なる地理的リージョンに分散保存されたデータを移動・コピーせずにSQLクエリを実行できるBigQueryのグローバルクエリ機能のプレビューを発表した。
キーポイント
グローバルクエリ機能のプレビュー開始
Google CloudがBigQuery向けの新機能「グローバルクエリ」のプレビューを発表した。
リージョン横断的なデータクエリの実現
異なる地理的リージョンに保存されたデータに対して、データを移動またはコピーすることなくSQLクエリを実行できる。
データ統合作業の効率化
従来必要だったデータの集約前の移動やコピー作業が不要になり、分析ワークフローが簡素化される。
影響分析・編集コメントを表示
影響分析
この機能は、グローバルに分散するデータの分析プロセスを大幅に簡素化し、データエンジニアやアナリストの作業効率を向上させる。特にマルチリージョン展開する企業のデータ分析基盤の近代化に貢献する可能性がある。
編集コメント
グローバルなデータ分析ニーズの高まりに対応する実用的な機能アップデート。プレビュー段階だが、実運用での効果が注目される。
Google Cloud は最近、BigQuery のグローバルクエリ機能のプレビューを発表しました。この新オプションにより、開発者はデータを集約するためにまず移動またはコピーする必要なく、異なる地理的領域に保存されたデータ間で SQL クエリを実行できるようになります。
ETL パイプラインの必要性を排除し、グローバルクエリは各領域からの結果を自動的に取得して結合します。これにより、分散型データセットを持つ企業の分析が簡素化されながら、クエリの実行場所を制御することも可能になります。Google のプロダクトマネージャーである Wawrzek Hyska 氏とソフトウェアエンジニアの Oleh Khoma 氏は次のように述べています。
背景では、BigQuery がクエリを実行するために必要なデータ移動を自動的に処理し、多地点分析のためのシームレスでゼロ ETL のエクスペリエンスを提供します。BigQuery は異なる領域で実行する必要があるクエリの各部分を特定し、それに応じて実行します。次に、メインクエリが実行される際に、これらの部分クエリの結果が選択された場所へ転送されます(転送サイズの最小化を試みる最適化が行われます)。最後にすべての部分が結合され、全体としてクエリが結果を返します。
例えば、標準 SQL クエリを使用することで、開発者はヨーロッパとアジアからの取引データを、米国からの顧客データと組み合わせることができます。同様の結果は、SQL 文を実行する前に ETL パイプラインを使用してデータをコピーして集約することによって BigQuery で達成可能でしたが、エンジンは今や異なる領域のデータ間でクエリを実行できるようになり、データ分析がよりシンプルかつ高速になりました。
SET @@location = 'US';
WITH transactions AS (
SELECT customer_id, transaction_amount FROM eu_transactions.sales_2024
UNION ALL
SELECT customer_id, transaction_amount FROM asia_transactions.sales_2024
)
SELECT
c.customer_name,
SUM(t.transaction_amount) AS total_sales
FROM
hq_customers.customer_list AS c
LEFT JOIN transactions AS t
ON c.id = t.customer_id
GROUP BY
c.customer_name
ORDER BY
total_sales DESC;
グローバルクエリは、リージョン間でデータを転送する必要があるため、単一リージョンのクエリよりもレイテンシが高くなります。この新機能には追加のコストと課題が伴い、規制によってはデータが元の場所から流出することを禁止している場合さえあります。そのため、開発者は明示的にグローバルクエリを実行する場所を指定してオプトインする必要があります。この新機能により、データエンジニアはデータの処理場所を制御できるようになり、データレジデンシーやコンプライアンス要件に合致させることができます。
Hyska と Khoma は次のように述べています。
異なる点は、BigQuery が今や数千マイルも離れたデータセット間で実行するようになったことです。これにより、アーキテクチャが劇的に簡素化され、インサイトを得るまでの時間が短縮されます。
Google Cloud だけが、単一の SQL ステートメントで分散データを照会するオプションを提供しているわけではありません。例えば、AWS は Amazon Redshift に対してリージョン間データ共有を提供しており、Athena もリージョンを跨いでデータをクエリできますが、BigQuery のグローバルクエリが行うようなリージョン間の分散実行を自動的に調整することはありません。
グローバルクエリを有効にするには、クエリを実行するリージョンで enable_global_queries_execution を true に設定し、データが保存されているリージョンで enable_global_queries_data_access を true に設定して、プロジェクトまたは組織の設定を更新する必要があります。クエリは 1 つのプロジェクトで実行され、キャッシュを使用せずに他のプロジェクトのリージョンにあるデータにアクセスできます。
グローバルクエリのコストには、リモートリージョン内の各サブクエリの計算コスト(現地の価格に基づく)、クエリが実行されるリージョンでの最終クエリのコスト、データレプリケーション価格に基づいたリージョン間でのデータコピーのコスト、およびプライマリリージョンにコピーされたデータを 8 時間保存するコストが含まれます。
新機能は現在プレビュー中です。
About the Author
Renato Losio
Renato はクラウドアーキテクト、技術リーダー、クラウドサービススペシャリストとして豊富な経験を持っています。現在はベルリンに住み、リモートでシニアクラウドアーキテクトとして勤務しています。主な関心領域はクラウドサービスとリレーショナルデータベースです。彼は InfoQ の編集者であり、認定された AWS Data Hero です。LinkedIn で彼に連絡することができます。
Show more
Show less
原文を表示
Google Cloud has recently announced the preview of a global queries feature for BigQuery. The new option lets developers run SQL queries across data stored in different geographic regions without first moving or copying the data to aggregate the results.
Removing the need for ETL pipelines, global queries automatically fetch and combine results from each region, simplifying analytics for companies with distributed datasets while letting them control where the query runs. Wawrzek Hyska, product manager at Google, and Oleh Khoma, software engineer at Google, write:
In the background, BigQuery automatically handles the data movement required to execute the query, giving you a seamless, zero-ETL experience for multi-location analytics. BigQuery identifies different parts of the query that must be executed in different regions and runs them accordingly. Next, results of these partial queries are transferred to a selected location when the main query is run (with an optimization attempt to minimize the size of transfer). Finally all parts are combined and the whole query returns the results.
For example, using a standard SQL query, developers can combine transaction data from Europe and Asia with customer data from the US. While similar results could be achieved on BigQuery using ETL pipelines to copy and centralize data before running the SQL statement, the engine can now run the query across data in different regions, making data analysis simpler and faster.
SET @@location = 'US';
WITH transactions AS (
SELECT customer_id, transaction_amount FROM eu_transactions.sales_2024
UNION ALL
SELECT customer_id, transaction_amount FROM asia_transactions.sales_2024
)
SELECT
c.customer_name,
SUM(t.transaction_amount) AS total_sales
FROM
hq_customers.customer_list AS c
LEFT JOIN transactions AS t
ON c.id = t.customer_id
GROUP BY
c.customer_name
ORDER BY
total_sales DESC;
Global queries incur higher latency than single-region queries due to the time required to transfer data between regions. As the new feature brings additional costs and challenges, and regulations might even prohibit data leaving the original location, developers must explicitly opt in by specifying the location where a global query is executed. The new feature allows data engineers to control where data is processed, aligning with their data residency and compliance requirements. Hyska and Khoma add:
What’s different is that BigQuery now executes it across datasets that are thousands of miles apart. This both dramatically simplifies your architecture and accelerates your time to insight.
Google Cloud is not the only provider offering options to query distributed data with a single SQL statement. For example, AWS provides cross-region data sharing for Amazon Redshift, and Athena can query data across regions, but it does not automatically coordinate distributed execution across regions the way BigQuery global queries do.
To enable global queries, data engineers must update the project or organization configuration by setting enable_global_queries_execution to true in the region where the query runs and enable_global_queries_data_access to true in the regions where the data is stored. Queries can run in one project and access data from regions in another project, without using any cache to avoid transferring data between regions.
The cost of a global query includes the compute cost of each subquery in remote regions based on local pricing, the cost of the final query in the region where it runs, the cost of copying data between regions under data replication pricing, and the cost of storing copied data in the primary region for eight hours.
The new feature is currently in preview.
About the Author
Renato Losio
Renato has extensive experience as a cloud architect, tech lead, and cloud services specialist. Currently, he lives in Berlin and works remotely as a principal cloud architect. His primary areas of interest include cloud services and relational databases. He is an editor at InfoQ and a recognized AWS Data Hero. You can connect with him on LinkedIn.
Show moreShow less
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み