blob: afdcb2b156ee2150cdf196f417919f810ab933c9 [file]
drop table ͪߩѦ¿ë¾î;
ERROR: table "ͪߩѦ¿ë¾î" does not exist
create table ͪߩѦ¿ë¾î (¿ë¾î text, ÝÂ×¾ÄÚµå varchar, ºñ°í1A¶ó±¸ char(16));
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named '¿ë¾î' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
create index ͪߩѦ¿ë¾îindex1 on ͪߩѦ¿ë¾î using btree (¿ë¾î);
create index ͪߩѦ¿ë¾îindex2 on ͪߩѦ¿ë¾î using hash (ÝÂ×¾ÄÚµå);
insert into ͪߩѦ¿ë¾î values('ÄÄÇ»Å͵ð½ºÇ÷¹ÀÌ', 'ѦA01ß¾');
insert into ͪߩѦ¿ë¾î values('ÄÄÇ»Åͱ׷¡ÇȽº', 'ÝÂB10ñé');
insert into ͪߩѦ¿ë¾î values('ÄÄÇ»ÅÍÇÁ·Î±×·¡¸Ó', 'ìÑZ01ù»');
vacuum ͪߩѦ¿ë¾î;
select * from ͪߩѦ¿ë¾î;
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸
------------------+----------+------------
ÄÄÇ»Å͵ð½ºÇ÷¹ÀÌ | ѦA01ß¾ |
ÄÄÇ»Åͱ׷¡ÇȽº | ÝÂB10ñé |
ÄÄÇ»ÅÍÇÁ·Î±×·¡¸Ó | ìÑZ01ù» |
(3 rows)
select * from ͪߩѦ¿ë¾î where ÝÂ×¾ÄÚµå = 'ìÑZ01ù»';
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸
------------------+----------+------------
ÄÄÇ»ÅÍÇÁ·Î±×·¡¸Ó | ìÑZ01ù» |
(1 row)
select * from ͪߩѦ¿ë¾î where ÝÂ×¾ÄÚµå ~* 'ìÑz01ù»';
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸
------------------+----------+------------
ÄÄÇ»ÅÍÇÁ·Î±×·¡¸Ó | ìÑZ01ù» |
(1 row)
select * from ͪߩѦ¿ë¾î where ÝÂ×¾ÄÚµå like '_Z01_';
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸
------------------+----------+------------
ÄÄÇ»ÅÍÇÁ·Î±×·¡¸Ó | ìÑZ01ù» |
(1 row)
select * from ͪߩѦ¿ë¾î where ÝÂ×¾ÄÚµå like '_Z%';
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸
------------------+----------+------------
ÄÄÇ»ÅÍÇÁ·Î±×·¡¸Ó | ìÑZ01ù» |
(1 row)
select * from ͪߩѦ¿ë¾î where ¿ë¾î ~ 'ÄÄÇ»ÅÍ[µð±×]';
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸
------------------+----------+------------
ÄÄÇ»Å͵ð½ºÇ÷¹ÀÌ | ѦA01ß¾ |
ÄÄÇ»Åͱ׷¡ÇȽº | ÝÂB10ñé |
(2 rows)
select * from ͪߩѦ¿ë¾î where ¿ë¾î ~* 'ÄÄÇ»ÅÍ[µð±×]';
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸
------------------+----------+------------
ÄÄÇ»Å͵ð½ºÇ÷¹ÀÌ | ѦA01ß¾ |
ÄÄÇ»Åͱ׷¡ÇȽº | ÝÂB10ñé |
(2 rows)
select *,character_length(¿ë¾î) from ͪߩѦ¿ë¾î;
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸ | character_length
------------------+----------+------------+------------------
ÄÄÇ»Å͵ð½ºÇ÷¹ÀÌ | ѦA01ß¾ | | 8
ÄÄÇ»Åͱ׷¡ÇȽº | ÝÂB10ñé | | 7
ÄÄÇ»ÅÍÇÁ·Î±×·¡¸Ó | ìÑZ01ù» | | 8
(3 rows)
select *,octet_length(¿ë¾î) from ͪߩѦ¿ë¾î;
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸ | octet_length
------------------+----------+------------+--------------
ÄÄÇ»Å͵ð½ºÇ÷¹ÀÌ | ѦA01ß¾ | | 16
ÄÄÇ»Åͱ׷¡ÇȽº | ÝÂB10ñé | | 14
ÄÄÇ»ÅÍÇÁ·Î±×·¡¸Ó | ìÑZ01ù» | | 16
(3 rows)
select *,position('µð' in ¿ë¾î) from ͪߩѦ¿ë¾î;
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸ | position
------------------+----------+------------+----------
ÄÄÇ»Å͵ð½ºÇ÷¹ÀÌ | ѦA01ß¾ | | 4
ÄÄÇ»Åͱ׷¡ÇȽº | ÝÂB10ñé | | 0
ÄÄÇ»ÅÍÇÁ·Î±×·¡¸Ó | ìÑZ01ù» | | 0
(3 rows)
select *,substring(¿ë¾î from 3 for 4) from ͪߩѦ¿ë¾î;
¿ë¾î | ÝÂ×¾ÄÚµå | ºñ°í1a¶ó±¸ | substring
------------------+----------+------------+-----------
ÄÄÇ»Å͵ð½ºÇ÷¹ÀÌ | ѦA01ß¾ | | Å͵ð½ºÇÃ
ÄÄÇ»Åͱ׷¡ÇȽº | ÝÂB10ñé | | Åͱ׷¡ÇÈ
ÄÄÇ»ÅÍÇÁ·Î±×·¡¸Ó | ìÑZ01ù» | | ÅÍÇÁ·Î±×
(3 rows)