0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

シャーディングとパーティション

0
Last updated at Posted at 2025-07-27

はじめに

データ量が増えてくるとよく出てくるワードが「シャーディング」と「パーティション」。
一見似たようなこの2つの概念ですが、設計思想も運用コストも大きく異なります。

シャーディングとは

シャーディング(Sharding) とは1つの大きなデータセットを、複数の物理テーブルやファイルに分割して管理する方法です。

よくある例:

logs_20230701, logs_20230702, ... というような日別テーブル

パーティションとは

パーティション(Partitioning) とは1つのテーブルの中で、内部的に日付やキーごとにデータを分割して管理する設計です。

比較表

項目 シャーディング パーティション
テーブル数 / ファイル数 多数(分割された個別の単位) 基本1つ(内部で分割)
クエリ ワイルドカードやUNION 通常のWHERE句で十分
管理性 煩雑、ミスが出やすい シンプル、拡張しやすい
BigQueryの制限 1000テーブル制限に引っかかる 制限なし(4000パーティションまで)
Sparkでの扱い 明示的にループなどで処理 partitionBy() で自動処理可
推奨度 非推奨(古い) 推奨(モダン設計)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?