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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:51:47+00:00 2026-05-13T16:51:47+00:00

If you got 100 000 users, is MySQL executing one SQL query at the

  • 0

If you got 100 000 users, is MySQL executing one SQL query at the time?

Because in my PHP code I check if a certain row exists; if it doesn’t it creates one. If it does, it just updates the row counter.

It crossed my mind that perhaps 100 users are checking if the row exists at the same time, and when it doesn’t they all create one row each.

If MySQL is handling them sequentially I know that it won’t be an issue, then one user will check if it exists, if not, create it. The other user will check if it exists, and since that’s the case, it just updates the counter.

But if they all check if it exists at the same time and let’s say it doesn’t, then they all create one row and the whole table structure will fail.

Would be great if someone could shed some light on this topic.

  • 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-13T16:51:47+00:00Added an answer on May 13, 2026 at 4:51 pm

    Use a UNIQUE constraint or, if viable, make the primary key one of your data items and the SQL server will prevent duplicate rows from being created. You can even use the “ON DUPLICATE KEY UPDATE …” syntax to specify the alternate operation if the row already exists.

    From your comments, it sounds like you could use the user_id as your primary key, in which case, you’d be able to use something like this:

    INSERT INTO usercounts (user_id,usercount)
    VALUES (id-goes-here,1)
    ON DUPLICATE KEY UPDATE usercount=usercount+1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 532k
  • Answers 532k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well pasring an xml into Array has various advantage as… May 17, 2026 at 12:04 am
  • Editorial Team
    Editorial Team added an answer The usual workflow: Provide a Javascript rich-text editor for your… May 17, 2026 at 12:04 am
  • Editorial Team
    Editorial Team added an answer You could also try Aspose Tasks: http://www.aspose.com/categories/.net-components/aspose.tasks-for-.net/default.aspx We are using… May 17, 2026 at 12:04 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I've got 80,000 users on my site and i've recently turned away from the
I got this code from w3schools, and tweaked it based on this one: Rename
I started working with linq to SQL several weeks ago. I got really tired
I've got a report that can generate over 30,000 records if given a large
This is the second time I have got confusing results from the modulo operator,
It's been several days that I got deadlock issues on a Java application with
I've got a project where we'll need to generate a lot of fixed-length random
My latest idea for do settings across my php project I am building was
I've got a web page that uses XMLHttpRequest to download a binary resource. In
I've got a sqlite table actions that looks something like this: uuid varchar (36)

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.