Peter Vary created HIVE-23042:
---------------------------------

             Summary: Merge queries to a single one for updating MIN_OPEN_TXNS 
table
                 Key: HIVE-23042
                 URL: https://issues.apache.org/jira/browse/HIVE-23042
             Project: Hive
          Issue Type: Bug
          Components: Transactions
            Reporter: Peter Vary
            Assignee: Peter Vary


When opening a new transaction we issue 2 queries to update the MIN_OPEN_TXN 
table.
{code}
<SELECT MIN("TXN_ID") FROM "TXNS" WHERE "TXN_STATE" = 'o'>
<insert into "MIN_HISTORY_LEVEL" ("MHL_TXNID", "MHL_MIN_OPEN_TXNID") 
values(763, 763)>
{code}

This could be archived with a single query faster, if we do not open 
transactions in batch, like:
{code}
<INSERT INTO "MIN_HISTORY_LEVEL" ("MHL_TXNID", "MHL_MIN_OPEN_TXNID")
  SELECT ?, MIN("TXN_ID") FROM "TXNS" WHERE "TXN_STATE" = 'o'>
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to