When working with large datasets that need to be divided into chunks for better management and the possibility to connect queries with other large datasets, hive’s bucketing feature comes in handy. However, in this essay, we’ll look at when bucketing isn’t a good idea.
Bucketing is not an option if –
- the table is small,
- quick sampling is necessary,
- map-side joins are being considered,
- the data is skewed,
- the table cardinality is not too high,
- and the table’s most common use case involves reading a subset of data, bucketing should be avoided.
You can break a table data set into smaller portions with bucketing in Hive, making it easier to handle. However, if the table is small, bucketing provides no meaningful benefit.
When you use bucketing, you limit the number of buckets in which you can store your data. This value is set in the table creation scripts. Joins on the Map side will be faster because to the equal quantities of data in each partition. However, if there is no need for map joins owing to limited data, bucketing is useless.
On columns with a high cardinality, partitions should not be generated. For instance, Student ID, Product ID, Customer ID, or any form of timestamps, or Amount, because this will result in millions of directories that the Hive will be unable to handle. In this case, bucketing will come in handy. If the cardinality is low, however, partitioning is preferable.
Hope you find this aritcle helpful.