ID Generation for Sharded Database (Azure Federated Database)

后端 未结 4 1088
后悔当初
后悔当初 2021-02-09 12:29

I have been looking for some articles or guidence on best practice for id generation (for the federated/primary key) for Azure Federated databases and haven\'t found anything co

4条回答
  •  隐瞒了意图╮
    2021-02-09 13:10

    When you think about your federation key it is important to think about a key that will actually cause a good distribution across federation members, so in many cases a generated id is not a good idea. For example - partitioning on order id will mean that all the latest orders are in the latest federation member, and is likely to be the one most users are acting on, so the benefits of federation will be greatly reduced, partitioning on country/customer id/etc is more likely to achieve the scalability benefits federation is designed to bring.

    When it comes to a row's unique identity you need to consider that entities will be stored accross different databases and for that reason identity or sequence generations are not available, check out Cihan Biyikoglu blog post on this - his recommendation is to either use uniqueidentifier or datetimeoffset

提交回复
热议问题