免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3880 | 回复: 8
打印 上一主题 下一主题

hash分区表数据分布不平衡的问题,急、急、急!!!!!!!! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-07-20 21:19 |只看该作者 |倒序浏览
hash分区表数据分布不平衡的问题,急、急、急!!!!!!!!

本人建立银行历史流水表的脚本如下,然后用insert into wyl_pub_jnl_2_history select * from ..语句将历史数据
插入该表中,但数据并未均匀分布在七个表空间里,在表空间userpart4上分布的数据时其它表空间的2倍,具体空间占用
情况如下表2,请各位高手指点迷津,急!!!,本人在线等待。


CREATE TABLE wyl_pub_jnl_2_history
(
    agt_inst        char(4)                 NOT NULL ,
    host_seqno      integer       DEFAULT 0 NOT NULL ,
    clt_seqno       char(                 NOT NULL ,
    tran_date       integer                 NOT NULL ,
    tran_time       char(14)                                 NOT NULL ,
    corr_date       integer,
    tran_abbr       char(20),
    tran_no         char(4),
    cstm_no1        char(14),
    cstm_no2        char(14),
    acc_id1         integer,
    acc_id2         integer,
    onebk_acc1      char(25),
    onebk_acc2      char(25),
    onebk_serno1    integer,
    onebk_serno2    integer,
    acc1            char(25)                NOT NULL ,
    acc2            char(25),
    acc_name1       char(40)                NOT NULL ,
    acc_name2       char(40),
    curr_type1      char(2)                 NOT NULL ,
    curr_type2      char(2),
    amt             decimal(16,2) DEFAULT 0 NOT NULL ,
    pk_no1          integer,
    pk_no2          integer,
    norm_int        decimal(16,2) DEFAULT 0 NOT NULL ,
    kpint           decimal(16,2) DEFAULT 0 NOT NULL ,
    fee_amt         decimal(16,2) DEFAULT 0 NOT NULL ,
    onebk_tran_flag char(2),
    proc_flag       char(2),
    dr_cr_flag      char(1),
    csh_tsf_flag    char(1),
    tlr             char(4),
    check_tlr       char(4),
    summ_no         integer,
    summ            char(30),
    auth_no         integer,
    flag            char(                 NOT NULL
) INITRANS 50 STORAGE(FREELISTS 5 FREELIST GROUPS 2)
partition by range (tran_date) subpartition by hash ( acc1 )
( partition wyl_pub_jnl_2_history_1   values  less than ( 38066 )
          (subpartition  sub_pub_jnl_2_history11 tablespace userpart1,  
           subpartition  sub_pub_jnl_2_history12 tablespace userpart2,  
           subpartition  sub_pub_jnl_2_history13 tablespace userpart3,  
           subpartition  sub_pub_jnl_2_history14 tablespace userpart4,
           subpartition  sub_pub_jnl_2_history15 tablespace userpart5,  
           subpartition  sub_pub_jnl_2_history16 tablespace userpart7,  
           subpartition  sub_pub_jnl_2_history17 tablespace userpart8 ),
partition wyl_pub_jnl_2_history_2   values  less than ( 38158 )
          (subpartition  sub_pub_jnl_2_history21 tablespace userpart1,  
           subpartition  sub_pub_jnl_2_history22 tablespace userpart2,  
           subpartition  sub_pub_jnl_2_history23 tablespace userpart3,  
           subpartition  sub_pub_jnl_2_history24 tablespace userpart4,
           subpartition  sub_pub_jnl_2_history25 tablespace userpart5,  
           subpartition  sub_pub_jnl_2_history26 tablespace userpart7,  
           subpartition  sub_pub_jnl_2_history27 tablespace userpart8 ),
partition wyl_pub_jnl_2_history_3   values  less than ( 38250 )
          (subpartition  sub_pub_jnl_2_history31 tablespace userpart1,  
           subpartition  sub_pub_jnl_2_history32 tablespace userpart2,  
           subpartition  sub_pub_jnl_2_history33 tablespace userpart3,  
           subpartition  sub_pub_jnl_2_history34 tablespace userpart4,
           subpartition  sub_pub_jnl_2_history35 tablespace userpart5,  
           subpartition  sub_pub_jnl_2_history36 tablespace userpart7,  
           subpartition  sub_pub_jnl_2_history37 tablespace userpart8 ),
partition wyl_pub_jnl_2_history_4   values  less than ( maxvalue )
          (subpartition  sub_pub_jnl_2_history41 tablespace userpart1,  
           subpartition  sub_pub_jnl_2_history42 tablespace userpart2,  
           subpartition  sub_pub_jnl_2_history43 tablespace userpart3,  
           subpartition  sub_pub_jnl_2_history44 tablespace userpart4,
           subpartition  sub_pub_jnl_2_history45 tablespace userpart5,  
           subpartition  sub_pub_jnl_2_history46 tablespace userpart7,  
           subpartition  sub_pub_jnl_2_history47 tablespace userpart8 )
);

                表1(空间占用情况)


        分区                  表空间名     大小(M)

SUB_PUB_JNL_2_HISTORY11  USERPART1   2240
SUB_PUB_JNL_2_HISTORY12  USERPART2   2176
SUB_PUB_JNL_2_HISTORY13  USERPART3   2176
SUB_PUB_JNL_2_HISTORY14  USERPART4   4341
SUB_PUB_JNL_2_HISTORY15  USERPART5   2176
SUB_PUB_JNL_2_HISTORY16  USERPART7   2176
SUB_PUB_JNL_2_HISTORY17  USERPART8   2176
SUB_PUB_JNL_2_HISTORY21  USERPART1   1536
SUB_PUB_JNL_2_HISTORY22  USERPART2   1536
SUB_PUB_JNL_2_HISTORY23  USERPART3   1536
SUB_PUB_JNL_2_HISTORY24  USERPART4   3072
SUB_PUB_JNL_2_HISTORY25  USERPART5   1536
SUB_PUB_JNL_2_HISTORY26  USERPART7   1536
SUB_PUB_JNL_2_HISTORY27  USERPART8   1536
SUB_PUB_JNL_2_HISTORY31  USERPART1   392
SUB_PUB_JNL_2_HISTORY32  USERPART2   392
SUB_PUB_JNL_2_HISTORY33  USERPART3   392
SUB_PUB_JNL_2_HISTORY34  USERPART4   776
SUB_PUB_JNL_2_HISTORY35  USERPART5   392
SUB_PUB_JNL_2_HISTORY36  USERPART7   392
SUB_PUB_JNL_2_HISTORY37  USERPART8   392
SUB_PUB_JNL_2_HISTORY41  USERPART1   .06
SUB_PUB_JNL_2_HISTORY42  USERPART2   .06
SUB_PUB_JNL_2_HISTORY43  USERPART3   .06
SUB_PUB_JNL_2_HISTORY44  USERPART4   .06
SUB_PUB_JNL_2_HISTORY45  USERPART5   .06
SUB_PUB_JNL_2_HISTORY46  USERPART7   .06
SUB_PUB_JNL_2_HISTORY47  USERPART8   .06

论坛徽章:
0
2 [报告]
发表于 2004-07-21 09:19 |只看该作者

hash分区表数据分布不平衡的问题,急、急、急!!!!!!!!

应该是tablespace的default storage的问题

论坛徽章:
0
3 [报告]
发表于 2004-07-21 19:10 |只看该作者

hash分区表数据分布不平衡的问题,急、急、急!!!!!!!!

已证实不是tablespace的default storage的问题,因为如果我的create 脚本中不在userpart4上建子分区的话,数据不均衡现象就会出现在userpart5上。今天我再次试验,hsah分区超过四个就会出现数据分布不均衡的现象,所以,我想请教各位是否hash分区不能超过4个?

论坛徽章:
0
4 [报告]
发表于 2004-07-23 22:34 |只看该作者

hash分区表数据分布不平衡的问题,急、急、急!!!!!!!!

hash ( acc1 )
估计与acc1的分布有关,将acc1的顺序倒一下试试

论坛徽章:
0
5 [报告]
发表于 2004-07-24 01:18 |只看该作者

hash分区表数据分布不平衡的问题,急、急、急!!!!!!!!

[quote="hljhrbwyl"]hash分区表数据分布不平衡的问题,急、急、急!!!!!!!!

本人建立银行历史流水表的脚本如下,然后用insert into wyl_pub_jnl_2_history select * from ..语句将历史数据
插入该表中,但数据并未均匀分布在..........[/quote]


将acc1字段单独建表作hash分区即可验证是否为值分布不均.

论坛徽章:
0
6 [报告]
发表于 2004-07-28 20:26 |只看该作者

hash分区表数据分布不平衡的问题,急、急、急!!!!!!!!

已验证将acc1字段单独建表作hash分区,结果还是分区数量不超出4个就能均匀分布,否则,还是不均匀。

请高手赐教。。。。。。

论坛徽章:
0
7 [报告]
发表于 2004-07-30 03:23 |只看该作者

hash分区表数据分布不平衡的问题,急、急、急!!!!!!!!

[quote="hljhrbwyl"]已验证将acc1字段单独建表作hash分区,结果还是分区数量不超出4个就能均匀分布,否则,还是不均匀。

请高手赐教。。。。。。[/quote]

论坛徽章:
0
8 [报告]
发表于 2004-07-30 16:54 |只看该作者

hash分区表数据分布不平衡的问题,急、急、急!!!!!!!!

看是不是在创建表时,加上参数PCTFREE,PCTUSED.

论坛徽章:
0
9 [报告]
发表于 2004-07-30 18:06 |只看该作者

hash分区表数据分布不平衡的问题,急、急、急!!!!!!!!

这样子的

你用select count(*) 来验证各个partition的行数


也可以不要userpart4这个表空间
重造一个....
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP