hive删除数据
按分區刪除:
ALTER TABLE test1 ?DROP PARTITION (dt='2016-04-29');
?
刪除符合條件的數據:
insert overwrite table t_table1 select * from t_table1 where XXXX;
其中xxx是你需要保留的數據的查詢條件。
insert overwrite table tlog_bigtable PARTITION (dt='2017-12-20',game_id = 'id') select * from tlog_bigtable t where t.dt = '2017-12-20' and t.event_time < '2017-12-20 20:00:00' and t.game_id = 'id'?
?
?
清空表:
insert overwrite table t_table1 select * from t_table1 where 1=0;
?
DROP?TABLE?[IF?EXISTS]?table_name ?;
TRUNCATE?TABLE?table_name
總結
- 上一篇: highcharts 去掉Highcha
- 下一篇: 服务器端与客户端TCP连接入门(三:多线