冷热数据分离行存 本页介绍天翼云TeleDB数据库冷热数据分离行存。 创建行存分区表 create table hot(id int, num int) partition by list(num); create table hotp1 partition of hot for values in (1); insert into hot values (1,1),(2,1),(3,1); d List of relations Schema Name Type Owner +++ datalakefdw hot table hotsep datalakefdw hotp1 table hotsep datalakefdw t table hotsep (3 rows) 此时分区子表为本地表。 热转冷 alter table hot alterpartition partition hotp1 set storagetype oss OPTIONS(server 'minioforeignserver', filePath '/bucketname/hostes01', enableCache 'true', format 'text'); hot:分区主表的名字。 hotp1:分区子表的名字。 oss:使用对象存储存储数据。 sever:创建的server服务器的名字。 filePath:数据存在对象存储的路径。 enableCache:是否使用缓存,true或false。 format:文件格式,csv或text。 d List of relations Schema Name Type Owner +++ datalakefdw hot table hotsep datalakefdw hotp1 foreign table hotsep datalakefdw t table hotsep (3 rows) 此时分区子表的类型为外表,可读不可写。 冷转热 alter table hot alterpartition partition hotp1 set storagetype local; hot:分区主表的名字。 hotp1:分区子表的名字。 local:数据存放在本地。 d List of relations Schema Name Type Owner +++ datalakefdw hot table hotsep datalakefdw hotp1 table hotsep datalakefdw t table hotsep (3 rows) 此时分区子表为本地表,可读可写。