Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 mysql 数据库,我正在尝试将 url 和唯一 id 放入两个单独的字段中。其中一个网址有时超过 800 个字符。我尝试创建 id 和 url 的唯一索引,这样我就不会多次链接到同一个 url/id 组合,但我收到有关索引字段长度的错误。
我目前将 url 存储为 varchar。我应该使用博客吗?或者是其他东西?这将如何影响 UNIQUE 索引?
将 URL 保留在一个TEXT字段中,将MD5URL 的哈希保留在另一列中,并在哈希列上创建唯一索引。
TEXT
MD5
我相信 varchar 的大小限制是 255。您应该将类型 varchar 更改为 text。