[ https://issues.apache.org/jira/browse/HIVE-22888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Denys Kuzmenko updated HIVE-22888: ---------------------------------- Description: - Created extra (db, tbl, part) index on HIVE_LOCKS table; - Replaced inner select under checkLocks using multiple IN statements with JOIN operator; generated query looks like : {code} SELECT LS.* FROM ( SELECT HL_LOCK_EXT_ID, HL_LOCK_INT_ID, HL_DB, HL_TABLE, HL_PARTITION, HL_LOCK_STATE, HL_LOCK_TYPE, HL_TXNID FROM HIVE_LOCKS WHERE HL_LOCK_EXT_ID < 14138) LS INNER JOIN ( SELECT HL_DB, HL_TABLE, HL_PARTITION FROM HIVE_LOCKS WHERE HL_LOCK_EXT_ID = 14138) LBC ON LS.HL_DB = LBC.HL_DB AND (LS.HL_TABLE IS NULL OR LS.HL_TABLE = LBC.HL_TABLE AND (LS.HL_PARTITION IS NULL OR LS.HL_PARTITION = LBC.HL_PARTITION)) WHERE LBC.HL_LOCK_TYPE='e' OR LBC.HL_LOCK_TYPE='w' AND LS.HL_LOCK_TYPE IN ('w','e') OR LBC.HL_LOCK_TYPE='r' AND (LS.HL_LOCK_TYPE='e' or LS.HL_LOCK_TYPE='w' and LS.HL_LOCK_STATE='w') LIMIT 1; {code} was: - Created extra (db, tbl, part) index on HIVE_LOCKS table; - Replaced inner select under checkLocks using multiple IN statements with JOIN operator; generated query looks like : {code} SELECT LS.* FROM ( SELECT HL_LOCK_EXT_ID, HL_LOCK_INT_ID, HL_DB, HL_TABLE, HL_PARTITION, HL_LOCK_STATE, HL_LOCK_TYPE, HL_TXNID FROM HIVE_LOCKS WHERE HL_LOCK_EXT_ID < 14138) LS INNER JOIN ( SELECT HL_DB, HL_TABLE, HL_PARTITION FROM HIVE_LOCKS WHERE HL_LOCK_EXT_ID = 14138) LBC ON LS.HL_DB = LBC.HL_DB AND (LS.HL_TABLE IS NULL OR LS.HL_TABLE = LBC.HL_TABLE AND (LS.HL_PARTITION IS NULL OR LS.HL_PARTITION = LBC.HL_PARTITION)) WHERE LBC.HL_LOCK_TYPE='e' OR LBC.HL_LOCK_TYPE='w' AND LS.HL_LOCK_TYPE IN ('w','e') OR LBC.HL_LOCK_TYPE='r' AND (LS.HL_LOCK_TYPE='e' or LS.HL_LOCK_TYPE='w' and LS.HL_LOCK_STATE='w'); {code} > Rewrite checkLock inner select with JOIN operator > ------------------------------------------------- > > Key: HIVE-22888 > URL: https://issues.apache.org/jira/browse/HIVE-22888 > Project: Hive > Issue Type: Improvement > Components: Locking > Reporter: Denys Kuzmenko > Assignee: Denys Kuzmenko > Priority: Major > Attachments: HIVE-22888.1.patch, HIVE-22888.2.patch > > > - Created extra (db, tbl, part) index on HIVE_LOCKS table; > - Replaced inner select under checkLocks using multiple IN statements with > JOIN operator; > generated query looks like : > {code} > SELECT LS.* FROM ( > SELECT HL_LOCK_EXT_ID, HL_LOCK_INT_ID, HL_DB, HL_TABLE, HL_PARTITION, > HL_LOCK_STATE, HL_LOCK_TYPE, HL_TXNID FROM HIVE_LOCKS > WHERE HL_LOCK_EXT_ID < 14138) LS > INNER JOIN ( > SELECT HL_DB, HL_TABLE, HL_PARTITION FROM HIVE_LOCKS WHERE HL_LOCK_EXT_ID > = 14138) LBC > ON LS.HL_DB = LBC.HL_DB > AND (LS.HL_TABLE IS NULL OR LS.HL_TABLE = LBC.HL_TABLE > AND (LS.HL_PARTITION IS NULL OR LS.HL_PARTITION = LBC.HL_PARTITION)) > WHERE LBC.HL_LOCK_TYPE='e' > OR LBC.HL_LOCK_TYPE='w' AND LS.HL_LOCK_TYPE IN ('w','e') > OR LBC.HL_LOCK_TYPE='r' AND (LS.HL_LOCK_TYPE='e' or LS.HL_LOCK_TYPE='w' > and LS.HL_LOCK_STATE='w') > LIMIT 1; > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)