删除分区表中的数据
alter table table_name drop partition(id=2019,code=70);
查看表所有分区
show partitions table_name;
查询某个分区下的数据
select * from dynamic_human2 where year=2018;
改表名
alter table 原表名 rename to 新表名
查看表的详细结构
desc formatted 表名
抽样查询
select * from 表名 tablesample(bucket 1 out of 4 on 字段);
4是hashcode取模取4,1是要抽取取模结果为1的数据,这两个数字都不是固定的
抽样查询是否能出结果跟表是否是分桶表无关.