You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "BELUGA BEHR (JIRA)" <ji...@apache.org> on 2017/12/19 01:29:00 UTC

[jira] [Updated] (HIVE-18300) Use LAST_INSERT_ID for Sequence Tables for MySQL

     [ https://issues.apache.org/jira/browse/HIVE-18300?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

BELUGA BEHR updated HIVE-18300:
-------------------------------
    Description: 
Instead of using SELECT FOR UPDATE, for MYSQL, use the recommended approach which only requires once client interaction instead of two:

{code:sql}
UPDATE child_codes SET counter_field = LAST_INSERT_ID(counter_field + 1);
SELECT LAST_INSERT_ID();
{code}

https://dev.mysql.com/doc/refman/5.7/en/innodb-locking-reads.html

  was:
Instead of using SELECT FOR UPDATE, for MYSQL, use the recommended approach which only requires once client interaction instead of two:

{code:sql}
UPDATE child_codes SET counter_field = LAST_INSERT_ID(counter_field + 1);
SELECT LAST_INSERT_ID();
{code}


> Use LAST_INSERT_ID for Sequence Tables for MySQL
> ------------------------------------------------
>
>                 Key: HIVE-18300
>                 URL: https://issues.apache.org/jira/browse/HIVE-18300
>             Project: Hive
>          Issue Type: Improvement
>          Components: HiveServer2
>    Affects Versions: 3.0.0
>            Reporter: BELUGA BEHR
>            Priority: Trivial
>
> Instead of using SELECT FOR UPDATE, for MYSQL, use the recommended approach which only requires once client interaction instead of two:
> {code:sql}
> UPDATE child_codes SET counter_field = LAST_INSERT_ID(counter_field + 1);
> SELECT LAST_INSERT_ID();
> {code}
> https://dev.mysql.com/doc/refman/5.7/en/innodb-locking-reads.html



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)