To retrieve all orders placed by a given user, at most one partition needs to be accessed. Rows within each partition are sorted based on order timestamps. It has multi-row partitions, where each partition corresponds to one user and each row corresponds to one order.
Table orders_by_user is designed to support data access pattern Q1. The logical data model for order management data is represented by the shown Chebotko Diagram. Logical data models can be conveniently captured and visualized using Chebotko Diagrams that can feature tables, materialized views, indexes and so forth. Next: Logical Data ModelĪ logical data model results from a conceptual data model by organizing data into Cassandra-specific data structures based on data access patterns identified by an application workflow. In this example, the update pattern is especially interesting because it may require updating rows in multiple tables and may involve race conditions. While Q1, Q2, Q3 and Q4 are used to retrieve data, U1 is intended to update data. Finally, canceling an order requires data access pattern U1.Īll in all, there are five data access patterns for a database to support. Showing an order status history requires data access pattern Q4. Showing all orders containing a specific item requires data access pattern Q3. Next, it is possible to go with one of the three remaining tasks.
The second task displays information about a selected order, which requires data access pattern Q2. This task is supported by data access pattern Q1. The first one is an entry-point task that shows all orders placed by a user. Ideally, each data access pattern should specify what attributes to search for, search on, order by, or do aggregation on. Its visual representation consists of application tasks, dependencies among tasks, and data access patterns. Next: Application WorkflowĪn application workflow is designed with the goal of understanding data access patterns for a data-driven application. For more information about other attribute types and key constraints, please refer to the diagram. Since the order status history entity type is a weak entity type, it is uniquely identified by the combination of an order id and order status timestamp. Finally, an order status history is maintained to keep track of all order statuses. Order items are derived from shopping cart items. For example, an order subtotal is computed based on prices and quantities of all items in an order. The last four attribute types are derived attribute types. Each order has a unique id, current status, timestamp, subtotal, shipping and handling fees, tax, and total. A checkout process involves one shopping cart, one payment method, one shipping address, one billing address and one delivery option, and results in one order. Each shopping cart can contain many items and each item or, to be more precise, item type can be found in many shopping carts. While a user can have many payment methods, addresses and shopping carts, each payment method, address and shopping cart must belong to exactly one user. The conceptual data model for order management data features users, payment methods, addresses, items, shopping carts, orders, delivery options, and order statuses. In this example, the model is captured using an Entity-Relationship Diagram (ERD) that documents entity types, relationship types, attribute types, and cardinality and key constraints. A conceptual data model is designed with the goal of understanding data in a particular domain.