[PHP] Mysql常见水平分表方案 - 利用merge存储引擎分表 →→→→→进入此内容的聊天室

来自 , 2020-07-20, 写在 PHP, 查看 110 次.
URL http://www.code666.cn/view/a4380923
  1. /**
  2.  * @param string $table_name 表名
  3.  * @param int $user_id 用户id
  4.  * @param int $total 分表总数
  5.  * @link http://www.phpddt.com
  6.  */
  7. function hash_table($table_name, $user_id, $total)
  8. {
  9.     return $table_name . '_' . (($user_id % $total) + 1);
  10. }
  11.  
  12. echo hash_table("artice", 1234, 5); //artice_5
  13. echo hash_table("artice", 3243, 5); //artice_4

回复 "Mysql常见水平分表方案 - 利用merge存储引擎分表"

这儿你可以回复上面这条便签

captcha