Picking the best primary key + numbering system

前端 未结 13 1605
盖世英雄少女心
盖世英雄少女心 2020-12-02 14:50

We are trying to come up with a numbering system for the asset system that we are creating, there has been a few heated discussions on this topic in the office so I decided

13条回答
  •  有刺的猬
    2020-12-02 15:32

    Follow the Don't Use policy.

    Some problems you can run into:

    You need to generate keys from more than one host.

    Someone will want to reserve contiguous numbers to use together.

    How meaningful will people want it to be? Wars are fought over this, and you're in the first skirmish of one already. "It's already meaningful, and if we just add two more digits we can ..." i.e. you're establishing a design style that will (should) be extensible.

    If you are concatenating the two, you're doing typecasts which can mess up your query Optimizer.

    You'll need to reclassify roads, and redefine their boundaries (i.e. move the roads), which implies changing the primary key and maybe losing links.

    There are workarounds for all this, but this is the kind of issue where workarounds proliferate and get out of control. And it doesn't take more than a couple to get beyond "Simple".

提交回复
热议问题