官术网_书友最值得收藏!

Coupling parents and children using static columns

The parent-child relationships we've encoded in our schema thus far are implicit in the structure of the primary keys but not explicit from Cassandra's standpoint. While we know that the user_status_updates.username column corresponds to the parent primary key users.username, Cassandra itself has no concept of the relationship between the two.

In a relational database, we might make the relationship explicit in the schema using foreign key constraints, but Cassandra doesn't offer anything like this. In fact, if we want to use two different tables for users and user_status_updates, there isn't anything we can do to explicitly encode their relationship in the database schema. However, there is a way to combine user profiles and status updates into a single table while still maintaining the one-to-many relationship between them. To achieve this merger, we'll use a feature of Cassandra tables that we haven't seen before—static columns.

主站蜘蛛池模板: 景德镇市| 贵德县| 宁陕县| 镇沅| 宜章县| 丹寨县| 衡东县| 抚顺市| 克东县| 五原县| 同德县| 都昌县| 维西| 城固县| 安多县| 张家港市| 鄂托克旗| 石泉县| 彭泽县| 盐亭县| 象山县| 镇平县| 蒙山县| 城固县| 长武县| 鸡泽县| 兴业县| 大宁县| 大同市| 张家口市| 威远县| 塔河县| 连云港市| 故城县| 永登县| 峨眉山市| 宜城市| 吉安县| 西青区| 鄂伦春自治旗| 汉川市|