- Learning Apache Cassandra(Second Edition)
- Sandeep Yarabarla
- 273字
- 2021-07-03 00:19:37
When to use static columns
We've now seen two ways to model users, each of whom has many status updates. The first approach was simply to define a table for users and a table for their status updates; the relationship between the two is encoded in the key structure of user_status_updates. The second approach is to store all of the information in one users_with_status_updates table using static columns to associate user-level data with the username partition key rather than having a different value for each clustering column. Which is better?
The answer largely depends on how closely coupled the related data types are. If we expect that most of our interactions with user profile information will also involve interacting with the user's status updates, and vice versa, then it makes a lot of sense to store them together in one table. The reasoning is similar to the parent-child conceptual framework discussed earlier, but in reverse. Not only is the user a special relationship from the standpoint of the status update, but also the status update is a special relationship from the standpoint of the user.
In the case of MyStatus, on balance, the relationship between users and status updates doesn't quite pass this test. In subsequent chapters, we'll expand our schema to accommodate several different one-to-many relationships where the user plays the role of parent. It's not clear that the relationship between users and status updates is more fundamental than the other relationships that we will model for users.
For this reason, we'll continue to work with the users and user_status_updates tables and leave behind the users_with_status_updates table as an interesting exercise.
- 大數據導論:思維、技術與應用
- 并行數據挖掘及性能優化:關聯規則與數據相關性分析
- Learning Apache Cassandra(Second Edition)
- 機器人智能運動規劃技術
- 快學Flash動畫百例
- 大數據處理平臺
- 單片機C語言程序設計完全自學手冊
- 智能生產線的重構方法
- Hands-On Dashboard Development with QlikView
- Drupal高手建站技術手冊
- Hands-On Deep Learning with Go
- 計算機應用基礎學習指導與練習(Windows XP+Office 2003)
- Keras Reinforcement Learning Projects
- ARM嵌入式開發實例
- 智能座艙之車載機器人交互設計與開發