[ https://issues.apache.org/jira/browse/HIVE-25879?focusedWorklogId=778978&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-778978 ]
ASF GitHub Bot logged work on HIVE-25879: ----------------------------------------- Author: ASF GitHub Bot Created on: 07/Jun/22 10:36 Start Date: 07/Jun/22 10:36 Worklog Time Spent: 10m Work Description: mszurap opened a new pull request, #3348: URL: https://github.com/apache/hive/pull/3348 ### What changes were proposed in this pull request? Performance optimization: the MetaStoreDirectSql#runTestQuery determines whether the direct SQL can be used. Before the fix the code queries the whole DBS table without any filters. The proposed change is to add a filter "WHERE DB_ID=1" which should be fast as it is the primary key for that table. ### Why are the changes needed? Performance improvement. With bigger deployments the test query can run 10x faster (~3 ms instead of 30 ms), and this test query runs for every ObjectStore initialization. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? In my local dev env I've run the "mvn test" successfully in the "standalone-metastore". Issue Time Tracking ------------------- Worklog Id: (was: 778978) Time Spent: 1h (was: 50m) > MetaStoreDirectSql test query should not query the whole DBS table > ------------------------------------------------------------------ > > Key: HIVE-25879 > URL: https://issues.apache.org/jira/browse/HIVE-25879 > Project: Hive > Issue Type: Bug > Reporter: Miklos Szurap > Priority: Major > Labels: pull-request-available > Time Spent: 1h > Remaining Estimate: 0h > > The runTestQuery() in the > org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java is using a test query > {code:java} > select "DB_ID" from "DBS"{code} > to determine whether the direct SQL can be used. > With larger deployments with many (10k+) Hive databases it would be more > efficienct to query a small table instead, for example the "VERSION" table > should always have a single row only. -- This message was sent by Atlassian Jira (v8.20.7#820007)