Let's make a complex dataset simple using Azure Cosmos DB Hansamali Gamage SSE (TIQRI) ● Blogger ● Speaker Let's make a complex dataset simple using Azure Cosmos DB
Azure Cosmos DB
Azure Cosmos DB Not a database, It’s a database service Low latency Multi model & Multi API support Global Distribution Elastic scale out Comprehensive SLAs
Why Azure CosmosDB
Partitioning & Global Distribution R/W R East Asia Product Category = ‘A’ Product Category = ‘B’ Product Category = ‘C’ R R/W Central US R R/W West US
Consistency vs Availability vs Response Time Data Distribution Consistency Availability
Scale throughput and storage Low response time Per application requirements Per second & per minute granularities
RU (Request Units) & Pricing RU is the Currency Control RU when you scale your apps calculated based on the computation per request
Cosmos DB is a database service Azure Cosmos DB Cosmos DB is a database service Key - value Column family Documents Graph DB
Azure Document API De-normalized data Document is a JSON object Flexible schema De-normalized data Stores data in documents Document is a JSON object Can have mixed data in a document Referential integrity is not enforced
Database Schema & Index Management in Document API Schema free Properties automatically indexed
Modeling data for a document database Data modeling is important as in a relational DB Enforcement of schema is a need by the developers
Are You Non-relational
ORM Normalized data What you store is what you get
Modeling the data in relational way Order Order Item Customer Product
Modeling the data in document way Order Id (key) Customer Items Item Product Item Product
Embed or Reference
Embed vs Reference
DEMO
Connect the dots You can try it yourself, check this article, Azure Cosmos DB: Designing your data structure
Thank you hansamaligamage@gmail.com http://hansamaligamage.blogspot.com/ https://goo.gl/DWDzdg https://goo.gl/7Pa5X8 @hansamaligamage