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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:51:36+00:00 2026-05-24T13:51:36+00:00

I am Working around MySQL error Deadlock found when trying to get lock; try

  • 0

I am Working around MySQL error “Deadlock found when trying to get lock; try restarting transaction”

I found out that the transaction can be safely reattempted

Deadlocks are not dangerous. Just try again.
http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html

There was a single “super insert..select” statement that inserted into the bottleneck table after selecting a joined combo of two other tables and using sub-statements conditions on the bottleneck table as well as a few tiny tables.

The bottle neck was “waiting for lock”, it was waiting for write lock no doubt. InnoDB seemed the perfect fit. (for write-heavy table) And the hesitations on this one statement are now all gone.

But now the problem arises: For every 100 executions of the statement, about 1 or 2 of them will fail because of the deadlock. I believe the deadlock only occurs between instances of the “super insert..select”. I will install an auto retry of that statement, but I wondered

Question: Does MySQL JDBC have an option to turn on auto-retry of statements after receiving the exception, or do I have to write my own code for that?

com.mysql.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction

In this case, I do not have start transaction or stop transaction commands. Just that one “super insert..select” statement

  • 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-24T13:51:37+00:00Added an answer on May 24, 2026 at 1:51 pm

    You can repeat the statement but in a perfect world you should rollback your transaction and start it again. And your transactions would be short in that world 🙂

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

Sidebar

Related Questions

I'm learning mysql and have been trying to get this working, but an error
I am trying to get my head around mysql. Can someone tell my why
Wanted to get some consensus around a UI feature I'm working on right now.
I'm working with about 20 objects that are moving around in 3D space. Adobe
I am working with a MySQL database that has capitalized table/field names like Users,
Still working my way around this, but is there any function/command I can use
I've looked around and can't seem to quite find a solution that meets my
I need to make a mysql connection and get some data back. I can
Sorry if the question is confused, as I'm confused myself. I'm working around these
Around here we have been working with a bunch of Visual Source Safe repositories

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.