Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6663317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:29:09+00:00 2026-05-26T02:29:09+00:00

For example, I have a row with a column C1 value = ‘clean’ ,

  • 0

For example, I have a row with a column C1 value = 'clean', and two different clients run this query at the same time:

update T1 set C1 = 'dirty' where Id = 1

Without using transactions, is it guaranteed regardless of engine type that the value of mysql_affected_rows() would be 1 for one client and 0 for the other?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:29:09+00:00Added an answer on May 26, 2026 at 2:29 am

    Yes and No 🙂

    In both cases, the access is serialised (assuming you’re using a transactional engine like InnoDB) since they hit the same row, so they won’t interfere with each other. In other words, the statements are atomic.

    However, the affected row count actually depends on your configuration set when you open the connection. The page for mysql_affected_rows() has this to say (my bold):

    For UPDATE statements, the affected-rows value by default is the number of rows actually changed. If you specify the CLIENT_FOUND_ROWS flag to mysql_real_connect() when connecting to mysqld, the affected-rows value is the number of rows “found”; that is, matched by the WHERE clause.

    And from the mysql_real_connect page:

    CLIENT_FOUND_ROWS: Return the number of found (matched) rows, not the number of changed rows.

    So, in terms of what happens with CLIENT_FOUND_ROWS being configured, the affected rows for:

    UPDATE T1 SET C1 = 'dirty' WHERE id = 1
    

    have nothing to do with whether the data is changed, only what rows matched. This would be 1 for both queries.

    On the other hand, if CLIENT_FOUND_ROWS was not set, the second query would not actually be changing the row (since it’s already populated with ‘dirty’) and would have a row count of zero.

    If you wanted the same behaviour regardless of that setting (only showing changes), you could use something like:

    UPDATE T1 SET C1 = 'dirty' WHERE id = 1 AND C1 <> 'dirty'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example: I have two shared objects (same should apply to .dlls). The first shared
I have got a table which contains 5 column and query requirements: update row
Why does: const char example; (uint64*)example have a value of 140734799798420 and *(uint64*)example have
Example: I have a selector like this, which I give to another method as
I have a collection of physical parameters associated with different items. For example: Item,
i want to know how to find the column value change or not Example
I have a larger SQL that produces a similar output as this simplified example:
I have a column with a bunch of rows with values like this. ZIP
If I for example have <p> some long text </p> on my HTML page,
I'm using the Silverlight UnitTest framerwork does anyone have a good example have how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.