Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][HIVE-26649] [Metastore] Hive metabase performance issues due to slow… #3714

Closed
wants to merge 1 commit into from

Conversation

SelfImpr001
Copy link

What changes were proposed in this pull request?

When the Hive metabase uses Mysql, during the peak period of Hive statement query, the metastore initiates a large number of DirectSQL, which will cause performance problems in the metabase. The fundamental reason is that some DirectSQL performance problems cause a large number of slow queries at the DB level. This PR is mainly for optimization. Slow query problem at the metabase level

Why are the changes needed?

For example for the following Hive query:

select * from imd_fcac_safe.fcac_dw_loan_details where ds='2021-10-10' and sysid='MCFCM'

where ds and sysid are the primary and secondary partitions of the imd_fcac_safe.fcac_dw_loan_details table, respectively

The Hive statement will generate the DirectSQL query as follows:

explain select PARTITIONS.PART_ID from PARTITIONS inner join TBLS on PARTITIONS.TBL_ID = TBLS.TBL_ID and TBLS.TBL_NAME = 'fcac_dw_loan_details' inner join DBS on TBLS.DB_ID = DBS.DB_ID and DBS.NAME = 'imd_fcac_safe' inner join PARTITION_KEY_VALS FILTER0 on FILTER0.PART_ID = PARTITIONS.PART_ID and FILTER0.INTEGER_IDX = 0 inner join PARTITION_KEY_VALS FILTER1 on FILTER1.PART_ID = PARTITIONS.PART_ID and FILTER1.INTEGER_IDX = 1 where ( ((FILTER0.PART_KEY_VAL = '2021-10-10') and (FILTER1.PART_KEY_VAL = 'MCFCM')) )
image

Problems with this statement
There is no TBL_ID field in the PARTITION_KEY_VALS table, which will cause the partition of the same name of the unrelated table to be described when performing an associated query; there is no index column in the PARTITION_KEY_VAL table, so it cannot be accelerated by the index.

Does this PR introduce any user-facing change?

No

How was this patch tested?

After compiling and packaging, execute the relevant partition filtering statement through the client. After repairing, the corresponding query corresponds to the DirectSQL execution plan as follows:

image

It can be seen that the amount of query data for partitioned tables has decreased. During the peak period of Hive tasks, the CPU load performance problem at the DB level has decreased.

@sonarcloud
Copy link

sonarcloud bot commented Oct 30, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@SelfImpr001
Copy link
Author

Can someone please review this pr

@github-actions
Copy link

github-actions bot commented Jan 2, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.

@github-actions github-actions bot added the stale label Jan 2, 2023
@github-actions github-actions bot closed this Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants