hivehiveddl

Do I need to do msck repair table after alter table?


I have a partitioned by column 'date' table to which I added a column like so: ALTER TABLE table_name ADD COLUMNS (message_id_external string) CASCADE;

Do I need to do msck repair table after this and analyze table table_name partition(date) compute statistics noscan; ?


Solution

  • REPAIR TABLE does not care about columns, it checks that all partitions which are in metadata exist in HDFS and vice-versa, it will not refresh any metadata for existing partitions -- No, you do not need to run it if no partition locations were added or removed from HDFS. If there are no partition folders were created or removed, repair will do nothing.

    Second command analyze table table_name partition(date) compute statistics noscan; - also will give you nothing, if you executed it previously before adding column.

    ANALYZE with NOSCAN will gather only number of files and their size