{"action":"created","issue":{"url":"https://api.github.com/repos/greenplum-db/gpdb/issues/160","labels_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/160/labels{/name}","comments_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/160/comments","events_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/160/events","html_url":"https://github.com/greenplum-db/gpdb/issues/160","id":121094960,"number":160,"title":"wrong information in pg_appendonly after executing alter table set distributed by statement  ","user":{"login":"yangqi2004","id":15450390,"avatar_url":"https://avatars.githubusercontent.com/u/15450390?v=3","gravatar_id":"","url":"https://api.github.com/users/yangqi2004","html_url":"https://github.com/yangqi2004","followers_url":"https://api.github.com/users/yangqi2004/followers","following_url":"https://api.github.com/users/yangqi2004/following{/other_user}","gists_url":"https://api.github.com/users/yangqi2004/gists{/gist_id}","starred_url":"https://api.github.com/users/yangqi2004/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangqi2004/subscriptions","organizations_url":"https://api.github.com/users/yangqi2004/orgs","repos_url":"https://api.github.com/users/yangqi2004/repos","events_url":"https://api.github.com/users/yangqi2004/events{/privacy}","received_events_url":"https://api.github.com/users/yangqi2004/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-08T20:42:33Z","updated_at":"2015-12-10T06:28:50Z","closed_at":null,"body":"### table information in pg_appendonly is wrong after 'alter table set distributed by ' statement. \r\n \r\n* create an columar appendonly table with compression.\r\n```\r\ngpadmin=# drop table public.test123;\r\nDROP TABLE\r\ngpadmin=# create table public.test123 (\r\ngpadmin(# col1 text,\r\ngpadmin(# col2 text,\r\ngpadmin(# col3 int\r\ngpadmin(# )\r\ngpadmin-# with ( appendonly = true, orientation = column, compresslevel = 4, compresstype=zlib)\r\ngpadmin-# distributed by (col1);\r\nCREATE TABLE\r\ngpadmin=# \\dt test123\r\n                     List of relations\r\n Schema |  Name   | Type  |  Owner  |       Storage\r\n--------+---------+-------+---------+----------------------\r\n public | test123 | table | gpadmin | append only columnar\r\n(1 row)\r\n```\r\n* table information in pg_appendonly, the table is compressed with zlib.\r\n```\r\ngpadmin=#\r\ngpadmin=# SELECT c.relname, a.compresstype, a.compresslevel, a.blocksize, a.checksum\r\ngpadmin-# FROM pg_catalog.pg_appendonly a, pg_catalog.pg_class c\r\ngpadmin-# WHERE c.oid = a.relid AND c.oid = 'public.test123'::regclass;\r\n relname | compresstype | compresslevel | blocksize | checksum\r\n---------+--------------+---------------+-----------+----------\r\n test123 | zlib         |             4 |     32768 | t\r\n(1 row)\r\n```\r\n* alter table set new distribution key\r\n```\r\ngpadmin=# alter table public.test123 set distributed by (col1);\r\nALTER TABLE\r\n```\r\n* After the change, the information in pg_appendonly - column compresstype and compresslevel is wrong.\r\n```\r\ngpadmin=#\r\ngpadmin=# SELECT c.relname, a.compresstype, a.compresslevel, a.blocksize, a.checksum\r\ngpadmin-# FROM pg_catalog.pg_appendonly a, pg_catalog.pg_class c\r\ngpadmin-# WHERE c.oid = a.relid AND c.oid = 'public.test123'::regclass;\r\n relname | compresstype | compresslevel | blocksize | checksum\r\n---------+--------------+---------------+-----------+----------\r\n test123 |              |             0 |     32768 | t\r\n(1 row)\r\n\r\ngpadmin=#\r\ngpadmin=# \\dt test123\r\n                     List of relations\r\n Schema |  Name   | Type  |  Owner  |       Storage\r\n--------+---------+-------+---------+----------------------\r\n public | test123 | table | gpadmin | append only columnar\r\n(1 row)\r\n```"},"comment":{"url":"https://api.github.com/repos/greenplum-db/gpdb/issues/comments/163514576","html_url":"https://github.com/greenplum-db/gpdb/issues/160#issuecomment-163514576","issue_url":"https://api.github.com/repos/greenplum-db/gpdb/issues/160","id":163514576,"user":{"login":"hlinnaka","id":191602,"avatar_url":"https://avatars.githubusercontent.com/u/191602?v=3","gravatar_id":"","url":"https://api.github.com/users/hlinnaka","html_url":"https://github.com/hlinnaka","followers_url":"https://api.github.com/users/hlinnaka/followers","following_url":"https://api.github.com/users/hlinnaka/following{/other_user}","gists_url":"https://api.github.com/users/hlinnaka/gists{/gist_id}","starred_url":"https://api.github.com/users/hlinnaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hlinnaka/subscriptions","organizations_url":"https://api.github.com/users/hlinnaka/orgs","repos_url":"https://api.github.com/users/hlinnaka/repos","events_url":"https://api.github.com/users/hlinnaka/events{/privacy}","received_events_url":"https://api.github.com/users/hlinnaka/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T06:28:50Z","updated_at":"2015-12-10T06:28:50Z","body":"On 10/12/15 01:58, Asim RP wrote:\n> Hi @yangqi2004\n>\n> Glad that you are interested in column oriented tables to the point of looking into `pg_appendonly`.  Your observation is not a bug.  For column oriented tables, Greenplum offers column specific encodings for compression and block size.  Therefore, `pg_appendonly` is not adequate to capture this information for each column.  We have a separate catalog table called `pg_attribute_encoding` for column oriented tables, that captures each column's compression details and block size.\n\nHmm. What are the compression-related columns in pg_appendonly used for, \nthen?\n\n- Heikki\n\n"}}