This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing one of the necessary scripts to find the size of Column Data in Greenplum. We are checking the size of table/index/schema/database, but we should also analyze the size of columns.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
select (gdr.segment_file_num/128)+1 as ColumnNumber ,isc.column_name as ColumnName ,lpad(pg_size_pretty(sum(gdr.mirror_append_only_new_eof)::bigint),15) as SizeOfColumn from gp_dist_random('gp_persistent_relation_node') gdr inner join ( select n.nspname ,c.relname ,relfilenode FROM pg_class c, pg_namespace n WHERE n.oid = c.relnamespace AND c.relkind = 'r' AND c.relstorage = 'c' ) parts on (gdr.relfilenode_oid = parts.relfilenode) inner join information_schema.columns isc on ((gdr.segment_file_num/128)+1) = isc.ordinal_position and parts.nspname = isc.table_schema and parts.relname = isc.table_name group by 1,2 |
Leave a Reply