码迷,mamicode.com
首页 > 其他好文 > 详细

模式设计

时间:2018-09-18 14:24:10      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:contains   login   com   分表   hdf   nbsp   logger   hive   time   

按天划分表的模式  一天一张表如果用户登录日志 login_20180101,login_20180102

在hive中可以使用按天分区,这样查询效率高,而且比按天分表看起来更清新明了

hive> create table loginfo(userid int,logintime timestamp) partitioned by (dateid int);
OK
Time taken: 0.292 seconds

hive> alter table loginfo add partition(dateid=20180101);
OK
Time taken: 0.585 seconds
hive> alter table loginfo add partition(dateid=20180102);
OK
Time taken: 0.464 seconds
hive> alter table loginfo add partition(dateid=20180103);
OK
Time taken: 0.557 seconds

[root@host ~]# hdfs dfs -ls /user/hive/warehouse/gamedw.db/loginfo
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/root/hadoop/hadoop-2.7.4/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/root/hive/apache-hive-2.1.1/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Found 3 items
drwx-wx-wx   - root supergroup          0 2018-09-18 13:46 /user/hive/warehouse/gamedw.db/loginfo/dateid=20180101
drwx-wx-wx   - root supergroup          0 2018-09-18 13:46 /user/hive/warehouse/gamedw.db/loginfo/dateid=20180102
drwx-wx-wx   - root supergroup          0 2018-09-18 13:47 /user/hive/warehouse/gamedw.db/loginfo/dateid=20180103

 

模式设计

标签:contains   login   com   分表   hdf   nbsp   logger   hive   time   

原文地址:https://www.cnblogs.com/playforever/p/9668480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!