当前位置: 首页 > news >正文

扬州市住房和城乡建设局网站上海网站建设开发公司

扬州市住房和城乡建设局网站,上海网站建设开发公司,wordpress网页打开慢,安卓中文开发工具目录 一、背景 二、准备测试数据 1.建表 2.造测试数据 三、操作 1.CTAS (1).无分区表测试 (2).分区表测试 2.LIKE (1).无分区表测试 (2).分区表测试 一、背景 有一张ori_…

目录

一、背景

二、准备测试数据

1.建表

2.造测试数据

三、操作

1.CTAS

(1).无分区表测试

(2).分区表测试

2.LIKE

(1).无分区表测试

(2).分区表测试


一、背景

有一张ori_table,想新建一张表new_table,保持跟ori_table一样的表结构,但是不复制ori_table的数据。

二、准备测试数据

1.建表

create table ori_table (
id   bigint,
col1 string,
col2 double
)comment '无分区原始表'
stored as orc;create table ori_table_partition (
id   bigint,
col1 string,
col2 double
)comment '有分区原始表'
partitioned by (dt string)
stored as orc;

2.造测试数据

insert into ori_table values (1,'哈哈',10.02);
insert into ori_table values (2,'嘿嘿',20.06);
insert into ori_table values (3,'嘻嘻',30.08);insert into ori_table_partition partition(dt='1') values (1,'哈哈',10.02);
insert into ori_table_partition partition(dt='2') values (2,'嘿嘿',20.06);
insert into ori_table_partition partition(dt='3') values (3,'嘻嘻',30.08);

三、操作

有2种办法

1.CTAS

(1).无分区表测试

--复制与ori_table表结构及表数据都一致的语句create table new_table as select * from ori_table;--只复制与ori_table表结构的语句
create table new_table as select * from ori_table where 1=0;

show create table new_table;   --执行看一下效果

 

select * from new_table;  --执行看一下数据量

 

由此得出结论,无分区表使用该语句可以满足需求!

(2).分区表测试

--复制与ori_table_partition表结构及表数据都一致的语句create table new_table_partition as select * from ori_table_partition;--只复制与ori_table表结构的语句
create table new_table_partition as select * from ori_table_partition where 1=0;

show create table new_table_partition;     --执行看一下效果

 

 这里看到表结构还是有些差异的,执行后将分区表建成了无分区表,分区字段创建成了普通字段。

select * from new_table_partition;   --执行看一下数据量

结论:

CTAS语法不适用于分区表

2.LIKE

(1).无分区表测试

--只复制与ori_table表结构的语句
create table new_table_like like ori_table;

show create table new_table_like;  --执行看一下效果

select * from new_table_like;   --执行看一下数据量

 

 

(2).分区表测试

--只复制与ori_table_partition表结构的语句
create table new_table_partition_like like ori_table_partition;

show create table new_table_partition_like; --执行看一下效果

 select * from new_table_partition_like;   --执行看一下数据量

结论:

LIKE语法适用于分区表及无分区表 

http://www.zhongyajixie.com/news/61174.html

相关文章:

  • 正规的网站建设杭州网站优化公司
  • 做零食的网站有哪些品牌整合营销传播
  • 上海网站建设 知名做aso推广平台
  • 网站开发的职责怎么买域名自己做网站
  • 唐山网页设计免费刷seo
  • 网页设计公司建设网站江苏免费关键词排名外包
  • 重庆网站建站价格人工在线客服
  • 武汉新闻最新消息视频上海seo培训中心
  • zion小程序开发郑州网站优化软件
  • 网站建设后如何放在网上培训课程安排
  • 安卓应用开发环境seo自媒体运营技巧
  • 采集wordpress整站数据怎么从网上找客户
  • 做金融网站需要什么营业执照大数据培训班出来能就业吗
  • drupal还是wordpress好北京优化网站方法
  • 益阳做网站的公司怎么网站推广
  • 五金公司宣传册设计样本烟台seo
  • 郑州建站公司网站外链交易平台
  • 做网站运营工资是不是很低百度手机浏览器下载
  • 网站交互式重庆森林在线观看
  • 微信客户端网站建设网络营销的盈利模式
  • 大良网站智能推广机构独立站怎么建站
  • 如何做电影下载网站google免登录网页版
  • wordpress登陆注册界面360网站关键词排名优化
  • 西安知名网站建设公司排名关键词搜索量排名
  • 淄博易宝网站建设在线域名查询网站
  • 百度推广怎么做的网站免费建站软件
  • 莱芜哪家企业做网站免费友情链接网
  • 建设学校网站前的需求分析网页搜索关键词
  • 做批发网站seo顾问合同
  • 好的h5网站互联网营销的优势