在 mysql 中有效存储 md5 哈希的最佳实践有效、mysql

2023-09-07 09:30:50 作者:出租半张床

可能的字段类型:

BINARY(16)
CHAR(32)
BIGINT + BIGINT

我如何决定使用哪一个?

How do I decide which one to use?

推荐答案

如果列被索引并且你知道你在做什么,出于性能原因,BINARY(16).

If the column is indexed and you know what you're doing, BINARY(16) for performance reasons.

否则,CHAR(32) 就可以了.确保该列使用 ascii 字符集.(例如ascii_bin)

Otherwise, CHAR(32) is fine. Make sure the column uses the ascii charset though. (ascii_bin for example)

 
精彩推荐
图片推荐