Solved

Are race conditions an issue in mySQL INSERTs?

Posted on 2011-03-02
2
564 Views
Last Modified: 2012-05-11
Hello.  I am new to the concept of race conditions, and most of my tables have numeric primary keys set to auto-increment.  Is this a potential problem?  As in, is it possible that 2 INSERT statements could fire simultaneously on a table and leave me with 2 rows with matching primary keys?
0
Comment
Question by:chaseivey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
Aaron Tomosky earned 65 total points
ID: 35024275
Nope. SQL is made for that stuff.
0
 
LVL 4

Assisted Solution

by:gizmola
gizmola earned 60 total points
ID: 35025676
A primary key is by definition unique, so there's no possibility of that happening.  Additionally AUTO_INCREMENT is inherently built around a table lock that serializes the allocation of new id's to insert statements.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question