Determining the Table Index
Table index description
| Index Type | Index Features | Supported Engine | Preferred Scenario |
|---|---|---|---|
| SIMPLE |
| Spark |
|
| BUCKET |
| Spark/Flink |
|
| BLOOM |
| Spark |
|
| GLOBAL_BLOOM |
| Spark |
|
| GLOBAL_SIMPLE |
| Spark |
|
Typical Scenarios
- COW tables are always written with INSERT OVERWRITE, and BUCKET indexes can be used.
- When COW tables are written with INSERT INTO, exercise caution when using BUCKET indexes because BUCKET indexes may cause incremental data and all BUCKET buckets need to update. As a result, the write speed becomes slower. If the data volume is tens of thousands or millions, you can select SIMPLE or BUCKET for COW tables. If the data volume is more than 10 million, SIMPLE is recommended.
- When MOR tables are written with INSERT INTO, BUCKET indexes are recommended. BUCKET indexes are applicable to write and read across multiple engines and scenarios with a large amount of data. However, compaction needs to be performed periodically.
- Writing MOR tables with INSERT OVERWRITE is not recommended. You can use INSERT OVERWRITE and BUCKET indexes for COW tables.
Estimating the Number of Buckets in the BUCKET Index Table
The number of buckets of a Hudi table must be determined during table creation and cannot be changed later. If the number of buckets is not properly set, serious performance problems may occur. You must perform the following steps to estimate the number of buckets:
- Non-partitioned tables
- The estimated total number of data records in the Hudi table is A, which cannot equal to the number of existing data records. Consider the growth rate of the Hudi table in the next five years. For example, the total data records of the Hudi table will increase to A in the next five years.
- Check the size of a single data record in the Hudi table, which is B (in KB). Use limit 100 to randomly query 100 service data records in the source table and save the 100 service data records to a TXT file. B = TXT file size (in KB) / 100.
- Check the data volume C (in GB) of the Hudi table before compression. C = A x B / 1024 / 1024.
- Estimate the number of buckets of the Hudi table D. D = MAX (rounded up (C/2 x 1.5), 4).
D = MAX (rounded up (C/2 x 1.5), 4). In this formula, 2 indicates that 2 GB data is stored in a bucket, and 1.5 indicates that 1.5 times buckets are reserved for the non-partitioned table.
- Partitioned tables
- Estimate the total number of data records in a single partition of the Hudi table as A. That is, in the next five years , the total number of data records in a single partition will increase to A. For example, if data is partitioned by day, you need to consider the amount of data generated on special holidays in the next few years. If data is partitioned by year, you need to consider the service data growth in the next few years.
- Check the size of a single data record in the Hudi table, which is B (in KB). Use limit 100 to randomly query 100 service data records in the source table and save the 100 service data records to a TXT file. B = TXT file size (in KB) / 100.
- Check the data volume C (in GB) of the Hudi table before compression. C = A x B / 1024 / 1024.
- Estimate the number of buckets of the Hudi table D. D = MAX (rounded up (C/2), 1).
- The number of buckets must be estimated based on the uncompressed data volume instead of the size of the compressed file in the source table, for example, the Parquet file.
- It is best to set an even number of buckets, with a minimum of 4 for non-partitioned tables and a minimum of 1 for partitioned tables.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot