2

タイトルが示すように、私は Cassandra などの NoSQL DBS をかなり (読んで: 完全に) 初心者です。他の多くの人と同じように、私は以前に RMDBS を学びました。そこで、「WTF is a super column」やその他の明らかな Google ヒットについて少し読みましたが、これをモデル化する方法はまだわかりません。

ユーザー名/パスワード/名前/などのように、ユーザーを保存したいとします...そのユーザーが携帯電話と固定電話を持っている場合はどうなりますか? これは「正しい」方法ですか?(他のサイトで見られるのと同じ省略された JSON スタイルを使用)

Users: {    // <-- this is the Users SuperColumnFamily, keyed by username
    myuser: {    // <-- this is a User SuperColumn
        username = "myuser",    // <-- this is the username Column
        email = "myuser@googlemail.com",
        ...
    },
    ...
}

Phone: {    // <-- this is where the users phone numbers are stored
    myuser: {
        mobile = "0129386835235",
        landline = "123876912384",
    },
    ...
}

意見/訂正をお願いします

4

1 に答える 1

4

まず最初に、スーパー カラムを使用しないでください。見る:

http://www.quora.com/Cassandra-database/Why-is-it-bad-to-use-supercolumns-in-Cassandra

今あなたの質問に答えます。あなたが説明した例は、通常の列ファミリーだけで簡単にモデル化できます。

Users: { <- This is the name of the column family
  username1: { <- this is a row key within the column family, it is one of your usernames
    email: user@email.com <- these are all of the columns within this row, they correspond to attributes for this user
    mobile: ...
    landline: ...
  }
  username2: { <- another row for a different user
    email: diff@email.com
  }
}

各行には、そのユーザーを説明するための異なる列のセットがあるという点で、上記の柔軟なスキーマを見ることができます。

Cassandra データ モデルの詳細については、http: //www.datastax.com/docs/1.0/ddl/index を読むことをお勧めします。

于 2012-04-12T23:02:20.533 に答える