Files
openGauss-server/src/test/regress/expected/row_compression/normal_test.out
2022-06-22 11:07:21 +08:00

256 lines
12 KiB
Plaintext

create schema normal_test;
CREATE TABLE normal_test.tbl_pc(id int, c1 text) WITH(compresstype=1);
\d+ normal_test.tbl_pc
Table "normal_test.tbl_pc"
Column | Type | Modifiers | Storage | Stats target | Description
--------+---------+-----------+----------+--------------+-------------
id | integer | | plain | |
c1 | text | | extended | |
Has OIDs: no
Options: orientation=row, compresstype=1
INSERT INTO normal_test.tbl_pc SELECT id, id::text FROM generate_series(1,1000) id;
select count(*) from normal_test.tbl_pc;
count
-------
1000
(1 row)
select count(*) from normal_test.tbl_pc where id < 100;
count
-------
99
(1 row)
checkpoint;
vacuum normal_test.tbl_pc;
select count(*) from normal_test.tbl_pc;
count
-------
1000
(1 row)
select count(*) from normal_test.tbl_pc where id < 100;
count
-------
99
(1 row)
-- normal index
create index on normal_test.tbl_pc(id) WITH (compresstype=2,compress_chunk_size=1024);
alter index normal_test.tbl_pc_id_idx set (compresstype=1); --failed
ERROR: change compresstype OPTION is not supported
alter index normal_test.tbl_pc_id_idx set (compress_chunk_size=2048); --failed
ERROR: change compress_chunk_size OPTION is not supported
alter index normal_test.tbl_pc_id_idx set (compress_prealloc_chunks=2); --success
alter index normal_test.tbl_pc_id_idx set (compress_level=2); --success
set enable_seqscan = off;
set enable_bitmapscan = off;
select count(*) from normal_test.tbl_pc;
count
-------
1000
(1 row)
CREATE TABLE normal_test.tbl_partition(id int) WITH(compresstype=2,compress_chunk_size=1024) partition by range(id)
(
partition p0 values less than(5000),
partition p1 values less than(10000),
partition p2 values less than(20000),
partition p3 values less than(30000),
partition p4 values less than(40000),
partition p5 values less than(50000),
partition p6 values less than(60000),
partition p7 values less than(70000)
);
insert into normal_test.tbl_partition select generate_series(1,65000);
select count(*) from normal_test.tbl_partition;
count
-------
65000
(1 row)
checkpoint;
vacuum normal_test.tbl_partition;
select count(*) from normal_test.tbl_partition;
count
-------
65000
(1 row)
-- exchange
select relname, reloptions from pg_partition where parentid in (Select relfilenode from pg_class where relname like 'tbl_partition') order by relname;
relname | reloptions
---------------+----------------------------------------------------------------------------
p0 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p1 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p2 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p3 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p4 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p5 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p6 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p7 | {orientation=row,compresstype=2,compress_chunk_size=1024}
tbl_partition | {orientation=row,compresstype=2,compress_chunk_size=1024,wait_clean_gpi=n}
(9 rows)
create table normal_test.exchange_table(id int) WITH(compresstype=2,compress_chunk_size=1024);
ALTER TABLE normal_test.tbl_partition EXCHANGE PARTITION FOR(2500) WITH TABLE normal_test.exchange_table;
select count(*) from normal_test.tbl_partition;
count
-------
60001
(1 row)
-- spilit
ALTER TABLE normal_test.tbl_partition SPLIT PARTITION p1 AT (7500) INTO (PARTITION p10, PARTITION p11);
select relname, reloptions from pg_partition where parentid in (Select relfilenode from pg_class where relname like 'tbl_partition') order by relname;
relname | reloptions
---------------+----------------------------------------------------------------------------
p0 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p10 | {orientation=row,compresstype=2,compress_chunk_size=1024,wait_clean_gpi=y}
p11 | {orientation=row,compresstype=2,compress_chunk_size=1024,wait_clean_gpi=y}
p2 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p3 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p4 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p5 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p6 | {orientation=row,compresstype=2,compress_chunk_size=1024}
p7 | {orientation=row,compresstype=2,compress_chunk_size=1024}
tbl_partition | {orientation=row,compresstype=2,compress_chunk_size=1024,wait_clean_gpi=y}
(10 rows)
create index on normal_test.tbl_partition(id) local WITH (compresstype=2,compress_chunk_size=1024);
\d+ normal_test.tbl_partition
Table "normal_test.tbl_partition"
Column | Type | Modifiers | Storage | Stats target | Description
--------+---------+-----------+---------+--------------+-------------
id | integer | | plain | |
Indexes:
"tbl_partition_id_idx" btree (id) LOCAL WITH (compresstype=2, compress_chunk_size=1024) TABLESPACE pg_default
--?.*
--?.*
Has OIDs: no
Options: orientation=row, compresstype=2, compress_chunk_size=1024
select relname, reloptions from pg_partition where parentid in (Select relfilenode from pg_class where relname like 'tbl_partition_id_idx') order by relname;
relname | reloptions
------------+-------------------------------------------
p0_id_idx | {compresstype=2,compress_chunk_size=1024}
p10_id_idx | {compresstype=2,compress_chunk_size=1024}
p11_id_idx | {compresstype=2,compress_chunk_size=1024}
p2_id_idx | {compresstype=2,compress_chunk_size=1024}
p3_id_idx | {compresstype=2,compress_chunk_size=1024}
p4_id_idx | {compresstype=2,compress_chunk_size=1024}
p5_id_idx | {compresstype=2,compress_chunk_size=1024}
p6_id_idx | {compresstype=2,compress_chunk_size=1024}
p7_id_idx | {compresstype=2,compress_chunk_size=1024}
(9 rows)
-- unsupport
alter index normal_test.tbl_partition_id_idx set (compresstype=1);
ERROR: change compresstype OPTION is not supported
alter index normal_test.tbl_partition_id_idx set (compress_chunk_size=2048);
ERROR: change compress_chunk_size OPTION is not supported
alter index normal_test.tbl_partition_id_idx set (compress_prealloc_chunks=2);
ERROR: change partition compress_prealloc_chunks OPTION is not supported
create index rolcompress_index on normal_test.tbl_pc(id) with (compress_chunk_size=4096);
ERROR: compress_chunk_size/compress_prealloc_chunks/compress_level/compress_byte_convert/compress_diff_convert should be used with compresstype.
create table rolcompress_table_001(a int) with (compresstype=2, compress_prealloc_chunks=3);
ERROR: invalid compress_prealloc_chunks 3 , must be less than 2 for rolcompress_table_001
-- support
alter table normal_test.tbl_pc set (compress_prealloc_chunks=1);
-- new testcase
set search_path=normal_test;
\d+
--?.*
--?.*
--?.*
--?.*
--?.*
--?.*
(3 rows)
reset search_path;
CREATE TABLE normal_test.pre_handle(id int) WITH(compresstype=2, compress_chunk_size=512, compress_byte_convert=true, compress_diff_convert=true);
insert into normal_test.pre_handle select generate_series(1,1000);
checkpoint;
select count(*) from normal_test.pre_handle;
count
-------
1000
(1 row)
-- create table like test
create table normal_test.including_all(id int) with (compresstype=2);
create table normal_test.including_all_new(like normal_test.including_all including all); --success
create table normal_test.including_all_new2(like normal_test.including_all including reloptions); --success
\d+ normal_test.including_all_new
Table "normal_test.including_all_new"
Column | Type | Modifiers | Storage | Stats target | Description
--------+---------+-----------+---------+--------------+-------------
id | integer | | plain | |
Has OIDs: no
Options: orientation=row, compresstype=2
\d+ normal_test.including_all_new2
Table "normal_test.including_all_new2"
Column | Type | Modifiers | Storage | Stats target | Description
--------+---------+-----------+---------+--------------+-------------
id | integer | | plain | |
Has OIDs: no
Options: orientation=row, compresstype=2
create table normal_test.segment_off(id int) with (compresstype=2,segment=off); --success
--compress_diff_convert布尔值:
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert=t);
drop table if exists normal_test.tb1;
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='t');
drop table if exists normal_test.tb1;
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='f');
drop table if exists normal_test.tb1;
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert=yes);
drop table if exists normal_test.tb1;
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='no');
drop table if exists normal_test.tb1;
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='1');
drop table if exists normal_test.tb1;
--compress_byte_convert布尔值:
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=t,compress_diff_convert=true);
drop table if exists normal_test.tb1;
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert='t',compress_diff_convert=true);
drop table if exists normal_test.tb1;
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=f,compress_diff_convert=false);
drop table if exists normal_test.tb1;
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=yes,compress_diff_convert=TRUE);
drop table if exists normal_test.tb1;
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=NO,compress_diff_convert=OFF);
drop table if exists normal_test.tb1;
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert='1',compress_diff_convert=1);
drop table if exists normal_test.tb1;
--segment参数:
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = on);
drop table if exists normal_test.t_bool_value;
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = off);
drop table if exists normal_test.t_bool_value;
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = 1);
drop table if exists normal_test.t_bool_value;
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = 0);
drop table if exists normal_test.t_bool_value;
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = t);
drop table if exists normal_test.t_bool_value;
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = 't');
drop table if exists normal_test.t_bool_value;
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = yes);
drop table if exists normal_test.t_bool_value;
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = no);
drop table if exists normal_test.t_bool_value;
drop schema normal_test cascade;
NOTICE: drop cascades to 8 other objects
DETAIL: drop cascades to table normal_test.tbl_pc
drop cascades to table normal_test.tbl_partition
drop cascades to table normal_test.exchange_table
drop cascades to table normal_test.pre_handle
drop cascades to table normal_test.including_all
drop cascades to table normal_test.including_all_new
drop cascades to table normal_test.including_all_new2
drop cascades to table normal_test.segment_off