Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[第2回 Azure Cosmos DB 勉強会] Data modelling and partitioning in Azure Cosmos DB (Azure Cosmos DB でのデータモデリングとパーティション分割)

[第2回 Azure Cosmos DB 勉強会] Data modelling and partitioning in Azure Cosmos DB (Azure Cosmos DB でのデータモデリングとパーティション分割)

SATO Naoki (Neo)

September 13, 2020
Tweet

More Decks by SATO Naoki (Neo)

Other Decks in Technology

Transcript

  1. Data modelling and partitioning in Azure Cosmos DB (Azure Cosmos

    DB でのデータ モデリングとパーティション分割)
  2. What is partitioning? Andrew Theo Mark Tim Deborah Luis SELECT

    * FROM c WHERE c.username = 'Mark' our partition key
  3. What is partitioning? Andrew Theo Mark Tim Deborah Luis SELECT

    * FROM c WHERE c.favoriteColor = 'orange' ?
  4. Products: how to return category and tag names? products SELECT

    * FROM c WHERE c.categoryId = 'CategoryA' productCategories SELECT c.name FROM c WHERE c.id = 'CategoryA' productTags SELECT * FROM c WHERE c.id IN ('<tagId1>', '<tagId2>', '<tagId3>')
  5. Sales orders customers PK: customerId SELECT * FROM c WHERE

    c.customerId = 'CustomerA' AND c.type = 'salesOrder'
  6. Denormalizing the count of sales orders per customer CustomerA CustomerC

    CustomerB customer sales orders customers PK: customerId
  7. Denormalizing the count of sales orders per customer CustomerA CustomerC

    CustomerB update the customer add a sales order customers PK: customerId
  8. Denormalizing the count of sales orders per customer CustomerA CustomerC

    CustomerB update the customer add a sales order
  9. Sales orders customers PK: customerId SELECT * FROM c WHERE

    c.type = 'customer' ORDER BY c.salesOrderCount DESC