Chinaunix首页 | 论坛 | 博客
  • 博客访问: 219317
  • 博文数量: 119
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 1261
  • 用 户 组: 普通用户
  • 注册时间: 2012-05-23 17:50
文章分类

全部博文(119)

文章存档

2016年(8)

2015年(78)

2014年(33)

我的朋友

分类: 数据库开发技术

2015-02-11 14:10:04

 

 

Netezza -- join columns of the 2 table should be same dataType , or there will be data distribution or broadcast


create table test_a (id int) distribute on (id);
create table test_b (id char(10)) distribute on (id);

insert into test_a values (1001);
insert into test_b values ('1001');

 


select count(*),datasliceid from test_a group by datasliceid;
-- 1 42

 

select count(*),datasliceid from test_b group by datasliceid;
-- 2 10

 


select a.id from test_b b , test_a a where a.id = b.id ;

 

QUERY SQL:

explain verbose select a.id from test_b b , test_a a where a.id = b.id

 

 

QUERY VERBOSE PLAN:

Node 1.

[SPU Sequential Scan table "TEST_A" as "A" {(A."ID")}]

-- Estimated Rows = 1, Width = 4, Cost = 0.0 .. 0.0, Conf = 80.0

Restrictions:

(A."ID" NOTNULL)

Projections:

1:A."ID"

[SPU Broadcast]

[HashIt for Join]

Node 2.

[SPU Sequential Scan table "TEST_B" as "B" {(B."ID")}]

-- Estimated Rows = 1, Width = 4, Cost = 0.0 .. 0.0, Conf = 80.0

Restrictions:

(B."ID" NOTNULL)

Projections:

1:INT4((B."ID")::"VARCHAR")

Node 3.

[SPU Hash Join Stream "Node 2" with Temp "Node 1" {(B."ID")}]

-- Estimated Rows = 1, Width = 4, Cost = 0.0 .. 0.0, Conf = 64.0

Restrictions:

(EXPR."INT4((B."ID")::"VARCHAR")" = A."ID")

Projections:

1:A."ID"

[SPU Return]

[Host Return]

 

阅读(1617) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~