配置Hive支持update

配置

  1. hive-site.xml配置參數(shù)(CDH的配置參考如下圖)



    hive.support.concurrency=true
    hive.enforce.bucketing=true
    hive.exec.dynamic.partition.mode=nonstrict
    hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager
    hive.compactor.initiator.on=true
    hive.compactor.worker.threads=1
    hive.in.test=true

  2. 數(shù)據(jù)分桶并制定存儲(chǔ)格式這個(gè)必須指定,要不會(huì)報(bào)錯(cuò)
    2.1 因?yàn)閘oad導(dǎo)入數(shù)據(jù)的時(shí)候,只能分區(qū)不能分桶,所以先先將數(shù)據(jù)導(dǎo)入一個(gè)沒有分桶的臨時(shí)表,然后insert into有分桶的表中。

    create table test_tmp(
    id string,
    name string
    )row format delimited fields terminated by '\t';
    
    create table test(key string,
    id string,
    name string,
    device_id string)clustered by (name) into 2 buckets stored as orc TBLPROPERTIES('transactional'='true');
    

ORC壓縮率和查詢

  1. 壓縮率


    image.png
  2. 查詢和更新效率
    更新效率沒有明明顯變化,查詢count,1.2億數(shù)據(jù)3分鐘,orc存儲(chǔ)的5分鐘,具體的mapper和reducer的個(gè)數(shù)不同。

更多配置大家請(qǐng)參考

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容