Base solution for your next web application
Open Closed

Difference Between Int , long or Guid on Entity ID ? #4448


User avatar
0
simedbn created

Hello,

What is the pros and cos for using int or long over GUID in the entity ?

Thank you in advance


2 Answer(s)
  • User Avatar
    0
    bbakermmc created

    Google says: <a class="postlink" href="https://www.exceptionnotfound.net/integers-vs-guids-the-great-primary-key-debate/">https://www.exceptionnotfound.net/integ ... ey-debate/</a>

  • User Avatar
    0
    aaron created
    Support Team

    Nice share, @BBakerMMC. "Google says" is a bit misleading though, more like "Google gives this link".

    I would like to share a set of examples:

    • int: "Categories" of Items (many Items to one Category)
    • long: "Items" that any user can create
    • Guid: "Notifications" that are system-generated when an event occurs on an Item (many Notifications to one Item)

    Deal breakers from the article:

    • You DON'T want your URLs to be "hackable" by your end-users (or can't do proper permission checking on ids) → Guid
    • You need to be able to combine data from difference sources with little-to-no chance of duplicate GUIDs → Guid
    • sequential integers may give away other information (from a comment on the article) → Guid