<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 分表設計 ## 水平分表 物理方式分表設計 自己手動創建多個數據表出來 php程序需要考慮分表算法:數據往哪個表寫,從哪個表讀 ![](https://box.kancloud.cn/089fec9429c5d7a0a1f94bf70160e188_858x218.jpg) 創建4個物理分表 ~~~ create table goods_0( id int unsigned not null auto_increment, name varchar(32) not null, price decimal(10,2) not null , primary key(id) )engine myisam charset utf8; create table goods_1( id int unsigned not null auto_increment, name varchar(32) not null, price decimal(10,2) not null , primary key(id) )engine myisam charset utf8; create table goods_2( id int unsigned not null auto_increment, name varchar(32) not null, price decimal(10,2) not null , primary key(id) )engine myisam charset utf8; create table goods_3( id int unsigned not null auto_increment, name varchar(32) not null, price decimal(10,2) not null , primary key(id) )engine myisam charset utf8; ~~~ php在哪個分表實現數據的讀取、修改、刪除: ~~~ $id = $_GET[‘id’]; $num = $id%4;//計算余數,該余數是當前處理記錄對應數據表的序號標識。 //讀取 $sql = “select * from goods_$num where id = $id”; ~~~ **php給哪個分表實現數據添加** 方案:創建一個獨立的數據表flag,專門對記錄的主鍵id值進行維護。 ~~~ create table flag( id int primary key auto_increment )engine myisam charset utf8; ~~~ 通過flag表獲取ID,使用該ID,完成計算,確定向哪張表添加數據 ~~~ $sql = “insert into flag values (null)”;//該數據表需要定期delete清空。 mysql_query($sql) $id = mysql_insert_id(); $yu =$id%/4;//獲取新記錄的主鍵id值。 ~~~ ## 垂直分表 **水平分表:是把一個表的全部記錄信息分別存儲到不同的分表之中。 垂直分表:是把一個表的全部字段分別存儲到不同的表里邊。** 有的時候,一個數據表設計好了,里邊有許多字段,但是這些字段有的是經常使用的,有的是不常用的。在進行正常數據表操作的時候,不常用的字段也會占據一定的資源,對整體操作的性能造成一定的干擾、影響。 為了減少資源的開銷、提升運行效率,就可以把不常用的字段給創建到一個專門的輔表中去。 同一個業務表的不同字段分別存儲到不同數據表的過程就是“垂直分表”。 例如: 會員數據表有如下字段: 會員表:** user_id 登錄名 密碼 郵箱 手機號碼** 身高 體重 性別 家庭地址 身份證號碼 以上表,有常用的,也有是不常用的 為了使得常用字段運行速度更快、效率更高,把常用字段給調出來,因此數據表做以下垂直分表設計: 會員表(主)user字段:user_id 登錄名 密碼 郵箱 手機號碼 會員表(輔)user_fu字段:user_id 身高 體重 性別 家庭地址 身份證號碼 以上把會員表根據字段是否常用給分為兩個表的過程就是垂直分表。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看