How do I query UUIDs stored as binary in a database (JPA/Hibernate/MySQL)

后端 未结 3 969
再見小時候
再見小時候 2021-02-15 17:37

I have a Java/JPA/Hibernate/MySQL based app. I want to use UUIDs for object identity, however I want to ensure database performance does not suffer.

I found this great b

3条回答
  •  滥情空心
    2021-02-15 18:03

    16 bytes overhead on 1 billion of records is roughly 15Gb. If you do have that much of the data you will have more serious scalability problems to solve and those 15Gb at 10 cents/Gb or less will not really be a big deal. Many to many relationships can grow to that size quicker but it will still be not that much to worry about.

    To summarize, just go with string representation. It will save you a lot of effort in dealing with database at fairly small price.

    P.S. My personal preference is to use numeric ids, but that's separate discussion.

提交回复
热议问题