Best practices for efficiently storing md5 hashes in mysql(在 mysql 中有效存储 md5 哈希的最佳实践)
问题描述
可能的字段类型:
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)
这篇关于在 mysql 中有效存储 md5 哈希的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!