Hive:insert into table 与 insert overwrite table 区别
创建测试表,来测试看看测试结果:
create table test(name string,pwd string,createdate string)row format delimited fields terminated by ',';
第一步:使用insert into 插入数据到表中:
insert into test(name,pwd,createdate)values('name1','pwd1','2017-06-20 14:14:09');
insert into test(name,pwd,createdate)values('name1','pwd1','2017-06-20 14:14:09');
insert into test(name,pwd,createdate)values('name2','pwd2','2017-06-20 14:14:09');
insert into test(name,pwd,createdate)values('name2','pwd2','2017-06-20 14:14:09');
0: jdbc:hive2://10.78.152.52:21066/> select * from test;
+------------+-----------+----------------------+--+
| test.name | test.pwd | test.createdate |
+------------+-----------+----------------------+--+
| name1 | pwd1 | 2017-06-20 14:14:09 |
| name1 | pwd1 | 2017-06-20 14:14:09 |
| name2 | pwd2 | 2017-06-20 14:14:09 |
| name2 | pwd2 | 2017-06-20 14:14:09 |
+------------+-----------+----------------------+--+
第二步:不清理以上插入的记录,直接执行insert overwirte,并查询分析结果:
insert overwrite table test select 'name1' as name,'pwd1' as pwd,'2017-06-20 14:14:09' as createdate;
insert overwrite table test select 'name2' as name,'pwd2' as pwd,'2017-06-20 14:14:09' as createdate;
insert overwrite table test select 'name2' as name,'pwd2' as pwd,'2017-06-20 14:14:09' as createdate;
insert overwrite table test select 'name3' as name,'pwd3' as pwd,'2017-06-20 14:14:09' as createdate;
0: jdbc:hive2://10.78.152.62:21066/> select * from test;
+------------+-----------+----------------------+--+
| test.name | test.pwd | test.createdate |
+------------+-----------+----------------------+--+
| name3 | pwd3 | 2017-06-20 14:14:09 |
+------------+-----------+----------------------+--+
第三步:不清理上边步骤执行后的结果,接着执行以下sql语句,并查询结果:
insert overwrite table test select 'name2' as name,'pwd2' as pwd,'2017-06-20 14:14:09' as createdate;
0: jdbc:hive2://10.78.152.62:21066/> select * from test;
+------------+-----------+----------------------+--+
| test.name | test.pwd | test.createdate |
+------------+-----------+----------------------+--+
| name2 | pwd2 | 2017-06-20 14:14:09 |
+------------+-----------+----------------------+--+
Hive:insert into table 与 insert overwrite table 区别的更多相关文章
- 【原创】大叔问题定位分享(22)hive同时执行多个insert overwrite table只有1个可以执行
hive 2.1 一 问题 最近有一个场景,要向一个表的多个分区写数据,为了缩短执行时间,采用并发的方式,多个sql同时执行,分别写不同的分区,同时开启动态分区: set hive.exec.dyna ...
- hive INSERT OVERWRITE table could not be cleaned up.
create table maats.account_channel ROW FORMAT DELIMITED FIELDS TERMINATED BY '^' STORED AS TEXTFILE ...
- Hive-insert into table 与 insert overwrite table 区别
区分insert into 和 insert overowrite: 0. 命令格式 INSERT OVERWRITE|INTO TABLE tablename [PARTITION (partcol ...
- (转)Lua的table库函数insert、remove、concat、sort详细介绍
原帖链接:http://www.jb51.net/article/64711.htm#comments 有增注标识的地方为额外注释,非原帖内容. 函数列表:(增注:只能用于数组!) table.ins ...
- Lua的table库函数insert、remove、concat、sort详细介绍(转载)
函数列表: table.insert(table,[ pos,] value) table.remove(table[, pos]) table.concat(table[, sep[, i[, j] ...
- insert into linksvr or insert into from linksvr
通过链接服务器将实例A上的数据写入实例B,通常有以下两种方式--方案1:在实例A上执行insert into LinkForB.B..TableB select * from TableA--方案2: ...
- 使用batch insert解决MySQL的insert吞吐量问题
最近使用了一个非常简单易用的方法解决了业务上的一个insert吞吐量的问题,在此总结一下. 首先我们明确一下,insert吞吐量其实并不是指的IPS(insert per second),而是指的RP ...
- 【转载】alter table move 和 alter table shrink space的区别
move 和shrink 的共同点1.收缩段2.消除部分行迁移3.消除空间碎片4.使数据更紧密 shrink 语法: alter table TABLE_NAME shrink space [com ...
- mysql 数据库插入语句之insert into,replace into ,insert ignore
近期才发现mysql的插入语句竟然有如此多的使用方法,这里拿来分享一下. ①关于insert into : insert into table_name values(); insert into t ...
随机推荐
- Java 类文件结构
Java 诞生之时有句著名的宣传口号"Write Once, Run Anywhere.".但是,Java 语言本身不具备跨平台的能力,而是 JVM 提供了跨平台的能力. 事实上, ...
- linux 下后台运行python脚本
这两天要在服务器端一直运行一个Python脚本,当然就想到了在命令后面加&符号 $ python /data/python/server.py >python.log &说明: ...
- [译]Android view 测量布局和绘制的流程
原文链接 创造优秀的用户体验是我们开发者的主要目标之一.为此, 我们首先要了解系统是如何工作的, 这样我们才可以更好的与系统配合, 从它的优点中获益, 规避它的缺陷. 之前关于Android渲染过程的 ...
- 以太坊挖矿源码:ethash算法
本文具体分析以太坊的共识算法之一:实现了POW的以太坊共识引擎ethash. 关键字:ethash,共识算法,pow,Dagger Hashimoto,ASIC,struct{},nonce,FNV ...
- 重读 必须知道的.NET
1 .public ,对访问成员无限制,属于访问级别最高的权限. protected 访问包含类或者丛类派生类的类. internal 仅限于程序集, protected inernal 访问仅限于 ...
- 【数据库】mysql数据库索引
文章归属:http://feiyan.info/16.html,我想自己去写了,但是发现此君总结的非常详细.直接搬过来了 关于MySQL索引的好处,如果正确合理设计并且使用索引的MySQL是一辆兰博基 ...
- UITableViewStyleGrouped模式下多余间距
第一个section上边多余间距处理 // 隐藏UITableViewStyleGrouped上边多余的间隔 _tableView.tableHeaderView = [[UIView alloc] ...
- 【Pycharm】 写python代码的优秀IDE Pycharm
Pycharm 在用pycharm之前,我一直用的是本身也是由python写的ulipad做我的IDE,在linux上的话就直接用vim编辑器.但是碰到pycharm之后觉得这玩意儿太NB了,虽然说不 ...
- 源码实现 --> atoi函数实现
atoi函数实现 atoi()函数的功能是将一个字符串转换为一个整型数值. 例如“12345”,转换之后的数值为12345,“-0123”转换之后为-123. #include <stdio.h ...
- Tomcat 8启动速度慢原因1: At least one JAR was scanned for TLDs yet contained no TLDs
最近使用tomcat8启动项目时,发现At least one JAR was scanned for TLDs yet contained no TLDs这一步加载时间非常长, 从网上收集了各种资料 ...