SQL Antipatterns ch9 Metadata Tribbles (WIP)

SQL勉強メモ

出典: 


Metadata Tribbles

Don’t let data spawn metadata.

  • 顧客エンティティに収益カラムを毎年追加するようなケース
  • 毎年毎年時間とお金を浪費することに

    • DBAを交えて何度もミーティングを開き
    • 表空間の再構築のためにデータ移行のスケジュールを作成し
    • カラムを追加する

Objective: Support Scalability

  • DBはデータ容量が増えるとパフォーマンスが劣化する
  • 行数減らす

Antipattern: Clone Tables or Columns

  • パターン名はスタートレックの「トリブル」から

    • 愛玩動物だが、繁殖力がものすごいため有害
  • 「テーブルはすべからく行数が少なくなければならない」という誤解

    • テーブルを水平分割
    • カラムを複数に分割

コラム: Mixing Metadata with Data

Spawning Tables

Managing Data integrity

Synchronizing Data

Ensuring Uniqueness

Querying Across Tables

Synchronizing Metadata

Managing Referential Integrity

Identifying Metadata Tribbles Columns

How to Recognize the Antipattern

Legitimate Uses of the Antipattern

Solution: Partition and Normalize

Using Horizontal Partitioning

Using Vertical Partitioning

Fixing Metadata Tribbles Columns