【Teradata】块压缩(ferret工具)

多值压缩(MVC)

Enhanced Multi-Value Compression (MVC) or Value-List Compression
• Compress VARCHAR, VARBYTE, or VARGRAPHIC columns
• Number of characters in a compressed value is increased to 510.

算法压缩(ALC)

Algorithmic Compression (ALC) or Column Level Compression
• Allows users to apply a compression algorithm to data at the column level in a row.
– One example is to compress two-byte Unicode into one byte when the data is Latin (ASCII).
• Compression/decompression is done by specifying a UDF function.
– Teradata provides some UDFs to do compression for UNICODE and LATIN data columns.
– User can create and apply their own compression/decompression algorithms to columns.

块压缩(BLC)

Block Level Compression :在数据块实际写入/读取存储设备之前,Teradata在文件系统级别对整个数据块执行压缩。

压缩/解压缩整个数据块会增加CPU成本,但会减少IO。目前CPU成本在不断下降,IO成本还比较高,所以CPU换IO非常划算。

可以在系统上打开所有数据块压缩,也可以按表申请块压缩。

自动与其它压缩机制结合。

BLC将只压缩/解压缩数据块,但不会用于任何文件系统结构,如主/柱面索引、WAL日志和表头。


• How is BLC set for a specific table?
• When loading data, SET QUERY_BAND = 'BLOCKCOMPRESSION=YES/NO;' FOR SESSION;
• Ferret utility has new commands – COMPRESS/UNCOMPRESS table
• DBSControl settings

 

1.在dbscontrol中开启块压缩

display compression
modify compression 1 = on
write 

2.启动ferret

方法一:使用admin用户登录viewpoint,选择remote console,选择ferret工具

方法二:使用root用户登录节点

cnsterm 6
start ferret
日志提示started ferret in window 2
Ctrl + C 退出当前窗口

cnsterm 2  //2为start ferret命令显示窗口编号

3.记录ferret所有屏显日志  

//启动ferret后执行
output into /tmp/file.out

4.查看某表是否已经压缩,C代表全压缩,U代表无压缩

scope table ("ds.orders" *)   //单表
scope table ("ds.orders" *,"ds.orders_2016" *)   //多表
showblock

tableid "ds.orders" //查看表ID

5.进行块压缩

 同一时间仅能启动一个compress命令,/y参数代表无需确认。

compress  /y "ds.orders"      //压缩某张表
compress  /y "ds.*"   //压缩全库

6.解压缩

uncompress /y  "ds.orders"

 7.更新dbc的数据表大小信息

使用ferret工具进行压缩处理,dbc的空间信息不会及时更新,需要通过updatesapce工具进行处理,由于这个工具是针对整个库进行的,所以最好在一个库下面的所有表都压缩处理完成后,再统一执行一次。

如果某个表数据发生变更,也会自动更新DBC空间信息。

cnsterm 6
start updatespace
日志提示started update space in window 3
Ctrl + C 退出当前窗口

cnsterm 3  //3为start updatespace命令显示窗口编号
update all space for ds;

 

 

IDKCS001442

Question 
Re-creating tables show that they are occupying more space temporarily and shows correct space next day (or later time)
Answer
Working as Expected.
Space accounting is not immediate but the tables should be compressed immediately. Please check the "showblock /m" output in ferret to confirm if the table is compressed. as soon as the tables are created with compress option or if manual compression is done on the particular table using ferret then running updatespace is required to reflect the space change immediately or will reflect with next auto updatespace run .
 

转载于:https://www.cnblogs.com/badboy200800/p/10405922.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值