gpt4 book ai didi

database - 如何在不查询的情况下估计 HIVE 中的表大小?

转载 作者:可可西里 更新时间:2023-11-01 14:45:17 24 4
gpt4 key购买 nike

我想计算表的大小而不在 HIVE 中查询。

我如何在 HIVE 中执行此操作?(如果没有在数据库中选择,我没有任何权限,所以我不能使用显示属性等)

(例如)

  • 数据行数:100

  • columnName(Type) : userName(string), userNumber(int), userCode(bigint), userAge(int)

    • 用户名的最大长度:36

我是这样计算表格大小的。

  • 我以为string是8bytes,int是4bytes,bigint是8bytes(我没有考虑记录标题大小和列标题大小)

    • 100 * ((8*36)+4+8+4)
    • 总大小:30,400 字节

你能给我一些建议吗?

最佳答案

hdfs dfs -du -s {table locatoin}

(可选-h)

例如

hdfs dfs -du -s /user/hive/warehouse/mytable
110265307244 /user/hive/warehouse/mytable

hdfs dfs -du -s -h /user/hive/warehouse/mytable
102.7 G /user/hive/warehouse/mytable

关于database - 如何在不查询的情况下估计 HIVE 中的表大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42244343/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com