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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:40:54+00:00 2026-05-18T00:40:54+00:00

I have a query that I run once a day that takes certain tables

  • 0

I have a query that I run once a day that takes certain tables from my database and puts them into a single table so that I can quickly export the information in any format I require.

I am running into a problem however that gives me the following error: “SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction”

From what I understand it sounds like my query is trying to get a lock on the table when there already is a lock in place. However I confess that I do not know anything about table locking or how it works.

Really I am just trying to read the other tables and not write to them, is there a way that I can create the query but not request a lock?

My query is ridiculously long so that’s why I did not post it. If there are certain parts that you need let me know and I can post them.

  • 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-18T00:40:55+00:00Added an answer on May 18, 2026 at 12:40 am

    You could try using INSERT DELAYED, here is what it does:

    When a client uses INSERT DELAYED, it gets an okay from the server at once, and the row is queued to be inserted when the table is not in use by any other thread.

    If you are willing to see data in a mixed state, you can change the transaction isolation level

    SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
    -- Problematic SELECT query goes here --
    SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
    

    I learned that one from another SO answer by Jon Erickson

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

Sidebar

Related Questions

I have a SQL query that takes a very long time to run on
I have heard that Linq query write once can be run on SQL and
I have an update query being run by a cron task that's timing out.
I have a query that I'm executing from a .NET application to a SQL
I'm working with a MySQL query that writes into an outfile. I run this
I have a relatively light query that needs information from a local MySQL table
I have a LINQ query I wish to run and drop the result into
I have a query that is dynamically built after looking up a field list
I have a query that originally looks like this: select c.Id, c.Name, c.CountryCode, c.CustomerNumber,
I have a query that looks like this: public IList<Post> FetchLatestOrders(int pageIndex, int recordCount)

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.