Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to create partitions on existing Hive table?

avatar
New Contributor

I have a table with 38M rows which is being updated daily. The table is in orc format and it is managed table.

I want to create partitions on that table but I couldn't find a way to alter existing non-partitioned table to create partitions in that table.

I tried searching all over the google but the only option I was able to find was Create a new partitioned table and insert data into it from the old table.

I was wondering if there was any way to create partitions on an existing table. My HIVE version is 3.1.


Thanks & Regards,

Kartik

1 ACCEPTED SOLUTION

avatar

Yep, create a new one defined the way you want the partitions to be and then insert into that new one using dynamic partitioning and you'll be good to go. Good luck and happy Hadooping.

View solution in original post

3 REPLIES 3

avatar

Yep, create a new one defined the way you want the partitions to be and then insert into that new one using dynamic partitioning and you'll be good to go. Good luck and happy Hadooping.

avatar
New Contributor

Okay. Thanks! But the insertion of data takes too much time for a table with 38M records. Is there any efficient way or trick to do the insertion process faster? @Lester Martin

avatar

You could try to do a single INSERT INTO statement per partition and run as many of these simultaneously as your cluster has resources for.