<title>Data storage for hive (bucket table)</title> Data storage (bucket table) bucket table for hive
- A bucket table is a hash of the data, which is then stored in a different file.
For example, to create three buckets, the principle of creating a bucket is to create a bucket according to the name of the middle school student in the left table. In this way, the left side of the data in the bucket can be used to hash the student name, the same hash value of the column stored in the same bucket. For example, Tom, Jerry, and Scott after the operation their hash value is the same, then the three people's information will be stored in the same bucket.
With the bucket table, you can reduce the file block of the system, thus improving the query speed
0 How do I create a bucket table? (Create 5 buckets with a name)
create table bucket_table1
(sid int,sname string,age int)
clustered by(sname) into 5 buckets;
Look at the structure of the table
desc bucket_table1;
sid int
sname string
age int
It's the same as the normal table, but the same hash value is put in the same bucket when the data is put in.
This is the bucket table.
Data storage for the hive of Hadoop notes (bucket table)