GUID 是最终 ID 吗?

发布于 2024-08-31 03:07:00 字数 271 浏览 1 评论 0原文

我注意到有些人不打算使用通常的递增数字作为 ID,而是简单地生成 GUID。优点包括:

  • 快速、简单
  • 不需要跟踪以前的 ID
  • 即使在彼此不了解的情况下,也能保证在不同的机器上都是唯一的

一些缺点是:

  • 可能的性能瓶颈
  • 使用大量字节

我的理解是,使用 GUID 在以下方面是有益的:大多数情况下,除非时间或空间优化是一个问题。我错过了什么吗?或者你同意这个想法吗?

I noticed some people don't bother having the usual incremented number as ID but instead simply generate a GUID. The advantages include:

  • Quick and easy
  • No need to keep track of previous IDs
  • Guaranteed to be unique even across machines without knowledge of each other

Some disadvantages are:

  • Possibly performance bottleneck
  • Uses a large number of bytes

My understanding is that using a GUID is beneficial in most cases, except if optimization for time or space is an issue. Did I miss something? Or do you agree with this idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情栀口红 2024-09-07 03:07:00

一些缺点:

  • 如果您必须手动深入研究任何内容(调试等),就会很痛苦。它们完全不可读。
  • 如果您需要在 URL 中传递它们,那就太可怕了

A couple of cons:

  • Pain in the neck if you have to delve into anything manually (debuggin etc). They are completely unreadable.
  • Horrible if you ever need to pass them in a URL
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文