二.不可删表情况下 执行vacuum table,共享锁(但是需要膨胀率大于gp_append_only_compaction_threshold) 执行vacuum full table,DDL锁(很吃CPU和IO) 执行重分布,DDL
查看存储类型
1 2 3 4 5 6 7
# \timing 打开SQL执行时间 # select distinct relstorage from pg_class; h = 堆表(heap),索引 a = append only row存储表 c = append only column存储表 x = 外部表(external table) v = 视图
查看当前有哪些AO表
1
# select t2.nspname,t1.relname from pg_class t1,pg_namespace t2 where t1.relnamespace = t2.oid and relstorage in ('c','a');
# select * from (select t2.nspname, t1.relname, (gp_toolkit.__gp_aovisimap_compaction_info(t1.oid)).* from pg_class t1, pg_namespace t2 where t1.relnamespace=t2.oid and relstorage in ('c', 'a')) t where t.percent_hidden > 0.2;