Hive学习笔记 --- Hive外部表和内部表的关系

  • 1.默认情况下是内部表(MANAGED_TABLE);

  • 2.外部表(External Table)创建的时候需要加上External关键字,并指定位置存储位置;

  • 3.删除内部表会直接删除元数据(METADATA)以及存储数据;删除外部表仅仅会删除元数据,HDFS上的文件并不会删除;

  • 4.内部表由数据由Hive自由管理,外部表数据由HDFS管理;

  • 5.对内部表的修改直接同步给元数据,而对外部表的表结构和分区进行修改,则需要修复(MSCK REPAIR TABLE Table_NAME);

如下是Hive-WIKI中的关于外部表的描述:

A table created without the EXTERNAL clause is called a managed table because Hive manages its data.

Managed and External Tables

By default Hive creates managed tables, where files, metadata and statistics are managed by internal Hive processes. A managed table is stored under the hive.metastore.warehouse.dir path property, by default in a folder path similar to /apps/hive/warehouse/databasename.db/tablename/. The default location can be overridden by the location property during table creation. If a managed table or partition is dropped, the data and metadata associated with th

猜你喜欢

转载自blog.csdn.net/u012965373/article/details/105106916