You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by "Lei Chang (JIRA)" <ji...@apache.org> on 2016/04/10 11:58:25 UTC

[jira] [Comment Edited] (HAWQ-176) REORGANIZE parameter is useless when change distribute policy from hash to random

    [ https://issues.apache.org/jira/browse/HAWQ-176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15234030#comment-15234030 ] 

Lei Chang edited comment on HAWQ-176 at 4/10/16 9:58 AM:
---------------------------------------------------------

fixed in latest code.

{code}
postgres=# set default_hash_table_bucket_number = 2;
SET
postgres=# create table testreorg( i int , j int ,q int) distributed by (q);
CREATE TABLE
postgres=# insert into testreorg VALUES (1,1,1);
INSERT 0 1
postgres=# insert into testreorg VALUES (1,2,1);
INSERT 0 1
postgres=# insert into testreorg VALUES (2,3,1);
INSERT 0 1
postgres=# insert into testreorg VALUES (2,4,1);
INSERT 0 1
postgres=# insert into testreorg VALUES (2,5,1);
INSERT 0 1
postgres=# select relfilenode from pg_class where relname='testreorg';
 relfilenode 
-------------
       16508
(1 row)

postgres=# select * from pg_aoseg.pg_aoseg_16508;
 segno | eof | tupcount | varblockcount | eofuncompressed 
-------+-----+----------+---------------+-----------------
     2 |   0 |        0 |             0 |               0
     1 | 120 |        5 |             5 |             120
(2 rows)

postgres=# alter TABLE testreorg set with (REORGANIZE=true) DISTRIBUTED randomly;
ALTER TABLE
postgres=# select relfilenode from pg_class where relname='testreorg';
 relfilenode 
-------------
       16513
(1 row)

postgres=# select * from pg_aoseg.pg_aoseg_16513;
 segno | eof | tupcount | varblockcount | eofuncompressed 
-------+-----+----------+---------------+-----------------
     1 |  56 |        2 |             1 |              56
     2 |  72 |        3 |             1 |              72
(2 rows)

postgres=# select count(*) from testreorg;
 count 
-------
     5
(1 row)

postgres=# select * from testreorg;
 i | j | q 
---+---+---
 1 | 2 | 1
 2 | 4 | 1
 1 | 1 | 1
 2 | 3 | 1
 2 | 5 | 1
(5 rows)

{code}



was (Author: lei_chang):
fixed in latest code.

```
postgres=# set default_hash_table_bucket_number = 2;
SET
postgres=# create table testreorg( i int , j int ,q int) distributed by (q);
CREATE TABLE
postgres=# insert into testreorg VALUES (1,1,1);
INSERT 0 1
postgres=# insert into testreorg VALUES (1,2,1);
INSERT 0 1
postgres=# insert into testreorg VALUES (2,3,1);
INSERT 0 1
postgres=# insert into testreorg VALUES (2,4,1);
INSERT 0 1
postgres=# insert into testreorg VALUES (2,5,1);
INSERT 0 1
postgres=# select relfilenode from pg_class where relname='testreorg';
 relfilenode 
-------------
       16508
(1 row)

postgres=# select * from pg_aoseg.pg_aoseg_16508;
 segno | eof | tupcount | varblockcount | eofuncompressed 
-------+-----+----------+---------------+-----------------
     2 |   0 |        0 |             0 |               0
     1 | 120 |        5 |             5 |             120
(2 rows)

postgres=# alter TABLE testreorg set with (REORGANIZE=true) DISTRIBUTED randomly;
ALTER TABLE
postgres=# select relfilenode from pg_class where relname='testreorg';
 relfilenode 
-------------
       16513
(1 row)

postgres=# select * from pg_aoseg.pg_aoseg_16513;
 segno | eof | tupcount | varblockcount | eofuncompressed 
-------+-----+----------+---------------+-----------------
     1 |  56 |        2 |             1 |              56
     2 |  72 |        3 |             1 |              72
(2 rows)

postgres=# select count(*) from testreorg;
 count 
-------
     5
(1 row)

postgres=# select * from testreorg;
 i | j | q 
---+---+---
 1 | 2 | 1
 2 | 4 | 1
 1 | 1 | 1
 2 | 3 | 1
 2 | 5 | 1
(5 rows)

```

> REORGANIZE parameter is useless when  change distribute policy from hash to random 
> -----------------------------------------------------------------------------------
>
>                 Key: HAWQ-176
>                 URL: https://issues.apache.org/jira/browse/HAWQ-176
>             Project: Apache HAWQ
>          Issue Type: Bug
>          Components: Storage
>            Reporter: Dong Li
>            Assignee: Lei Chang
>             Fix For: 2.0.0
>
>
> When change distribute policy from hash to random with REORGANIZE=true, the data distribution is not reorgnized.
> Run commands as follow.
> {code}
> set default_segment_num=2;
> create table testreorg( i int , j int ,q int) distributed by (q);
> insert into testreorg VALUES (1,1,1);
> insert into testreorg VALUES (1,2,1);
> insert into testreorg VALUES (2,3,1);
> insert into testreorg VALUES (2,4,1);
> insert into testreorg VALUES (2,5,1);
> {code}
> gpadmin=# select relfilenode from pg_class where relname='testreorg';
>  relfilenode
> -------------
>        16840
> (1 row)
> gpadmin=# select * from pg_aoseg.pg_aoseg_16840;
>  segno | eof | tupcount | varblockcount | eofuncompressed | content
> -------+-----+----------+---------------+-----------------+---------
>      2 |   0 |        0 |             0 |               0 |      -1
>      1 | 160 |        5 |             5 |             160 |      -1
> (2 rows)
> {code}
> alter TABLE testreorg set with (REORGANIZE=true) DISTRIBUTED randomly;
> {code}
> gpadmin=# select relfilenode from pg_class where relname='testreorg';
>  relfilenode
> -------------
>        16845
> (1 row)
> gpadmin=# select * from pg_aoseg.pg_aoseg_16845;
>  segno | eof | tupcount | varblockcount | eofuncompressed | content
> -------+-----+----------+---------------+-----------------+---------
>      2 |   0 |        0 |             0 |               0 |      -1
>      1 | 120 |        5 |             1 |             120 |      -1
> (2 rows)
> The aoseg file is changed , but the data distribution has not changed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)