mysql 資料庫表分割槽

2021-07-27 22:46:35 字數 2046 閱讀 7021

create table if not exists `demo_range` (

`eventid` int(11) unsigned not null,

`event_sk` int(11) not null,

`product_sk` int(11) not null,

`date_sk` int(11) not null,

`deviceid` varchar(128) default null,

`useridentifier` varchar(128) default null,

`category` varchar(50) default null,

`event` varchar(50) not null,

`label` varchar(50) default null,

`attachment` varchar(512) default null,

`clientdate` datetime not null,

`number` int(11) not null

) engine=innodb auto_increment=1 default charset=utf8

partition by range (date_sk)

(partition p_2014 values less than (1828) engine = innodb,

partition p_2015 values less than (2193) engine = innodb,

partition p_201616 values less than (2375) engine = innodb,

partition p_2016712 values less than (2559) engine = innodb,

partition p_201701 values less than (2590) engine = innodb,

partition p_201702 values less than (2618) engine = innodb,

partition p_201703 values less than (2649) engine = innodb,

partition p_201704 values less than (2679) engine = innodb,

partition p_201705 values less than (2710) engine = innodb,

partition p_201706 values less than (2740) engine = innodb,

partition p_201707 values less than (2771) engine = innodb,

partition p_201708 values less than (2802) engine = innodb,

partition p_201709 values less than (2832) engine = innodb,

partition p_201710 values less than (2863) engine = innodb,

partition p_201711 values less than (2893) engine = innodb,

partition p_201712 values less than (2924) engine = innodb);

alter table `demo_range`

add primary key (`eventid`,`date_sk`),

add key `date_sk` (`date_sk`);

alter table `demo_range`

modify `eventid` int(11) unsigned not null auto_increment,auto_increment=1;

超大的表(十幾億條資料)被幾天輕鬆緊張中解決了,內心還是當一下

mysql的小爬蟲還是可以處理這些資料的。

如果資料量更多會用來做什麼,繼續分析處理資料吧 加油mysql

資料庫表分割槽

create database mytest on sql server 資料庫表分割槽由三個步驟來完成 1.建立分割槽函式 2.建立分割槽架構 3.對錶進行分割槽 1.0建立表分割槽函式 create partition function mypartfunc int as range right...

資料庫表分割槽

實現資料庫表分割槽步驟 1,檢視資料庫檔案儲存位置 select from v datafile 2,在伺服器上資料庫儲存位置上,新建表空間檔案 touch d part1.dbf touch d part2.dbf 第二種方式 在plsql或oracle命令端,建立表空間 3,建立表,並根據型別分...

資料庫表分割槽

create database mytest on sql server 資料庫表分割槽由三個步驟來完成 1.建立分割槽函式 2.建立分割槽架構 3.對錶進行分割槽 1.0建立表分割槽函式 create partition function mypartfunc int as range right...