Quantcast
Channel: ITPUB论坛-专业的IT技术社区
Viewing all articles
Browse latest Browse all 18583

分库分表的分库ID为何要先hash再取模?不能直接取模吗?

$
0
0
看到一篇文章,分库分表按用户ID分库,方法是将计算用户ID的hash值,将与分库数量(如10个)取模。 我的问题是,为何要先计算hash值? 是因为用户ID不一定是数值型? hash值为数值才能取模运算?

Viewing all articles
Browse latest Browse all 18583

Trending Articles