• CodexArcanum@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    12 days ago

    I’m hardly the king of databases, but always using a surrogate key (either an auto-incremented integet or a random uuid) has done me pretty well over the years. I had to engineer a combination of sequential timestamp with a hash extension as a key for one legacy system (keys had to be unique but mostly sequential), and an append-only log store would have been a better choice than an RDBMS, but sometimes you make it work with what you have.

    Natural keys are almost always a bad idea though. SSNs aren’t natural, which is one pitfall: implicitly relying on someone else’s data practices by assuming their keys are natural. But also, nature is usually both more unique than you want (every snowflake is technically unique) and less than you’d hoped (all living things share quite a lot of DNA). Which means you end up relying on how good your taxonomy is for uniqueness. As opposed to surrogate keys, which you can assure the uniqueness of, by definition, for your needs.

    • Sheridan@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      12 days ago

      He’s doing a “census audit” and trying to consolidate a lot of different datasets from different sources containing the same individuals. None of the sources contain any sort of unique ID column in common so he’s using the SSN I guess to join tables? I don’t fully understand what he’s doing. I don’t think he actually has a functioning relational database setup. The few glimpses I’ve seen of his Access database looks chaotic.

      Separately I made a simple database with the same persons for the purposes of generating monthly invoices, and I gave them auto-increment IDs; my database is supposed to link to his because he wants to monitor record changes and incorporate them into his ongoing census thing. But he’s not liking my primary key and keeps wanting me to switch to SSNs so it’s easier for him to do whatever he’s doing.