jiihye opened a new pull request, #5793: URL: https://github.com/apache/hive/pull/5793
<!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute 2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary 3. Ensure you have added or run the appropriate tests for your PR: 4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX: Your PR title ...'. 5. Be sure to keep the PR description updated to reflect all changes. 6. Please write your PR title to summarize what this PR proposes. 7. If possible, provide a concise example to reproduce the issue for a faster review. --> ### What changes were proposed in this pull request? This PR proposes to optimize the SQL query generated by the `get_table_meta` API in Hive Metastore by removing the use of the LOWER() function. - before ``` diff # JDOQL SELECT FROM org.apache.hadoop.hive.metastore.model.MTable + WHERE (database.catalogName == hive ) && (database.name.matches((?i)db_name) ) ``` - after ``` diff # JDOQL SELECT FROM org.apache.hadoop.hive.metastore.model.MTable + WHERE (database.catalogName == hive ) && (database.name.matches(db_name) ) ``` ### Why are the changes needed? In production environments with a large number of tables, we observed that the SQL query generated by `get_table_meta` caused full scans on the TBLS table, resulting in high CPU usage on the Metastore's MySQL backend. https://issues.apache.org/jira/projects/HIVE/issues/HIVE-28899?filter=allopenissues ### Does this PR introduce _any_ user-facing change? No. Since both database names and table names are already stored in lowercase in the Metastore DB, this change should not have any impact on users. This change is only applied to get_table_meta to minimize risk. Other commands were left unchanged as we are not yet certain about potential side effects in those paths. ### How was this patch tested? - Verified the generated SQL via logging. - Manually tested the change in a local Hive Metastore instance with MySQL 5.7 and a large dataset. - Observed a significant drop in CPU usage during repeated get_table_meta requests. - https://issues.apache.org/jira/projects/HIVE/issues/HIVE-28899?filter=allopenissues -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org