Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2012
    Posts
    7

    Unanswered: Should I lock table when execute update query?

    Should I lock table when execute query:
    update table tbl set counter = counter + 1 where name = "abc"
    And at the same time select data where counter > 10.
    If I should, how to lock table in mysql? LOCK TABLE ?
    Thanks.

  2. #2
    Join Date
    Aug 2012
    Posts
    7
    This query is atomic. No need to use LOCK TABLES.

    thread safety - Is incrementing a field in MySQL atomic? - Stack Overflow

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •