What is Partitioning in Azure Cosmos DB?

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 26

  • @randomlabs1784
    @randomlabs1784 4 года назад +1

    I am so glad I've found your channel , I was having a hard time understanding cosmosdb, Thanks Will !!

    • @willvelida
      @willvelida  3 года назад

      Glad to hear that I've helped in a small way 😊 If there's any Cosmos DB related content you'd like to see a video on, let me know and I'll add it to my backlog!

  • @zolisawelani9338
    @zolisawelani9338 2 года назад +1

    This is a good explanation of partitions.

  • @LifeisbetterwithaMalinois
    @LifeisbetterwithaMalinois 3 года назад +1

    Thanks Will, this is great, understand this now better :)

    • @willvelida
      @willvelida  9 месяцев назад

      Thanks for watching!

  • @katarinaradojicic3725
    @katarinaradojicic3725 5 месяцев назад

    Great video. I expected that the RequestCharge of the x-partition query will be the highest, but if was 0. How so?

  • @praveenraghuvanshi6489
    @praveenraghuvanshi6489 4 года назад

    A clear explanation... Awaiting for next video on throughput :-)
    One query, What would be the partition key in case of a IoT based solution with components in the order as Tenant -> Project -> Venue(Location) -> Device -> Parameters. A project could be spread across multiple areas within a location or different locations. A venue may contain large number of devices. Each device may have multiple parameters. I am looking at initial thought that might come to your mind and a reasoning over it. Let me know if you need more information.

    • @willvelida
      @willvelida  4 года назад

      Hi Praveen, thanks for watching,
      With this type of scenario, say if you have devices all around the world producing telemetry data, you could use an event sourcing model, where you have a Container that's partitioned by /id for your writes. Which will balance your write containers storage and throughput distribution nicely: docs.microsoft.com/en-us/azure/cosmos-db/partitioning-overview#using-item-id-as-the-partition-key
      You could then implement the Change Feed feature in Cosmos DB to listen to that container and then move that data into a container optimized for read operations with a different partition key on a property that will be heavily queried on (For example, location): docs.microsoft.com/en-us/azure/cosmos-db/change-feed
      You could even take a look at the Analytical Store feature (in preview at time of comment) if you need to do more sophisticated analytical jobs on your data using Azure Synapse: docs.microsoft.com/en-us/azure/cosmos-db/analytical-store-introduction
      Hope this helps you out!

    • @praveenraghuvanshi6489
      @praveenraghuvanshi6489 4 года назад +1

      @@willvelida Awesome, will check the referenced links.

  • @pradeeptiwari4193
    @pradeeptiwari4193 Год назад +1

    Great video. Shall we fire a x-partition query or one query per partition or create a change feed with another container?

    • @willvelida
      @willvelida  9 месяцев назад

      It depends on how often you are performing x-partition queries. If you do it occasionally, then it's ok. If you're executing that query numerous times, it's better to reevaluate that partition key and use the change feed to write to another container (or use a different database entirely).

  • @irynatyshchenko6851
    @irynatyshchenko6851 Год назад +1

    Good explnation

  • @goud410
    @goud410 3 года назад

    simple and good videos

  • @crickmoments3732
    @crickmoments3732 Год назад +1

    How to find the size of the particular partition key?
    I am facing partition key reached maximum 20gb limit what are possible solutions for this scenario.
    Please response

    • @willvelida
      @willvelida  9 месяцев назад

      Hi there, you can view this information using the PartitionKeyStatistics log category in Diagnostic logs. The product team have a doc on how to create alerts when PK size gets too large: learn.microsoft.com/en-us/azure/cosmos-db/how-to-alert-on-logical-partition-key-storage-size
      A possible solution for this is to re-evaluate your data model and see if there's a more granular partition key property that you can use.
      You could also use hierarchical partition keys to subpartition your data: learn.microsoft.com/en-us/azure/cosmos-db/hierarchical-partition-keys?tabs=net-v3%2Cbicep

    • @crickmoments3732
      @crickmoments3732 8 месяцев назад +1

      Thank you so much@@willvelida

  • @shubhamsrivastava9124
    @shubhamsrivastava9124 4 года назад +1

    Nice detailed explanation. Just a quick query.
    Whether throughput be evenly distributed between logical partition if only one physical partition is there ? In that case can problem of hot partition also occur for a given logical partition ?

    • @willvelida
      @willvelida  3 года назад

      Yes hot partitioning occurs at the logical partition level, even if you have only one physical partition. If your logical partition's storage is unevenly distributed compared to other logical partitions on your single physical partition, this logical partition will be considered 'hot'

  • @jesper7605
    @jesper7605 3 года назад +2

    Is it okay to use the id of a document/item as the partition key? I understand that's it's probably not ideal, but exactly how bad is it? The ID will be unique for every document/item.

    • @devmishra4700
      @devmishra4700 2 года назад +1

      wondering the same

    • @willvelida
      @willvelida  9 месяцев назад

      Using the ID of a doc/item as partition key is great for write heavy workloads, where you may not care about querying the id later and you just want to write it.
      In situations where you need to support heavy writes BUT query that item later, this is where the change feed can come in. That will help move that item from a Cosmos DB container to an alternative store (or another container) that's better suited for queries.

  • @DanishAli-el2fe
    @DanishAli-el2fe 3 года назад +1

    Where is the Modeling Cosmos first video link ?

    • @willvelida
      @willvelida  3 года назад +1

      Hey Danish, here's my video on Data Modelling in Azure Cosmos DB: ruclips.net/video/p5rRGlKxNtk/видео.html