一、大表
(1)列多:
纵向拆分大表:
create t1;
insert into t1 select id, name from test;
(2)行多:
根据数据存放特点和逻辑进行横向拆分大表:
a: 表分区
b: 分表(分多个表):
创建和原表结构一模一样的表:
create table country_1_p1 like country_1;
insert into country_1_p1 select code, name, continent from country_1 order by code limit 100;
-------------------------------------------------------------------------------------------------------------------------------------------
1、两个横切的表:
使用 union或union2:
country_1: ------> 100行数据
country_1_p1: ------> 139行数据
需要查询239行数据:
select * from country_1
union
select * from country_1_p1;
2、两个纵切的表:
使用 join