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 6644123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:07:50+00:00 2026-05-26T00:07:50+00:00

I have this MySQL table: video (id int, name varchar(30), view_count int) I tried

  • 0

I have this MySQL table:

video (id int, name varchar(30), view_count int)

I tried to run the following query on my computer:

update `video` set view_count = view_count + 1 where id = 1;

It works fine.

However, after I moved the database to another server, the above update query sometimes work, sometimes not work. It doesn’t have any error message, but the value doesn’t change.

I tried to run:

update `video` set name = 'testing', view_count = view_count + 1 where id = 1;

The name can be updated successfully, but the vide_count doesn’t change..

Anyone know what problem it is?

Here is the output from MySQL prompt:

update `video` set view_count = view_count + 1 where id = 1;
Query OK, 1 row affected (0.13 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> show create table video \G;
*************************** 1. row ***************************
       Table: video
Create Table: CREATE TABLE `video` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(30) default NULL,
  `view_count` int(10) default NULL,
  PRIMARY KEY  (`id`),
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

mysql> select * from video;
| id | name      | view_count |
|  1 | ABC       | 8510    | 
  • 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-26T00:07:51+00:00Added an answer on May 26, 2026 at 12:07 am

    MyISAM performs a full table lock on any DML (INSERT, UPDATE, DELETE)

    If the video table is MyISAM, that should take care of this problem because only one person is allowed to have exclusive write privilege on the table executing a single DML statement, even if 1000 people are trying to execute

    update `video` set name = 'testing', view_count = view_count + 1 where id = 1;
    

    InnoDB performs MVCC around any data you are updating. Since the default is REPEATABLE-READ, 1000 people may see the same value for view_count just before attempting to increment it. Thus, if DB Connection #1 sees view_count as 12, increments it, it should be 13. However, if DB Connection #2 sees view_count as 12, it wiil increment it, and be 13 AGAIN !!!

    Keep in mind that I am only speculating based on multiple DB Connections attempting the exact same UPDATE query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following mysql tables: CREATE TABLE `video` ( `video_id` int(11) unsigned NOT
I have this in a MySQL db: table Message sender_id int recipient_id int created
I have a MySQL table structured somewhat like this: type name value ===================== 1
I have a MySQL table that looks like this: `id` int(10) unsigned NOT NULL
I have an table structure like this mysql> SELECT id, name, parent_id FROM categories;
I have this in a mysql table: id and bolag_id are int . lat
I would like to ask something about query using mysql I have this table
I have this query that I'm running against mysql: SELECT video.title AS title, video.url
I have this MySQL table: CREATE TABLE `triple` ( `id_one` int(11) NOT NULL, `id_two`
I have this MySQL table but it takes one query for one comment. If

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.