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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:02:32+00:00 2026-05-28T01:02:32+00:00

I have this temp table that holds the data to be modified in table1,

  • 0

I have this temp table that holds the data to be modified in table1, to update table1 I use the query:

UPDATE table1 pr
INNER JOIN tmpTable tmp
ON (pr.product_id = tmp.product_id)
SET pr.isactive = tmp.isactive

But since tmpTable holds huge amount of data to update, my query sometimes ending up to ‘timeout’. So my question is, what’s basically the simplest way to update my data by batch? say, by 10K.

Thanks in advance!

  • 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-28T01:02:33+00:00Added an answer on May 28, 2026 at 1:02 am

    You tagged this in PHP so I’m assuming you’re willing to do some work with in there and not just in a single query. Run the query multiple times. Something like

    for($i<$minId; $i<maxId;$i+=10000){
    
      $db->query("UPDATE table1 pr
      INNER JOIN tmpTable tmp
      ON (pr.product_id = tmp.product_id)
      SET pr.isactive = tmp.isactive where isactive between $i and $i+10000");
    
    }
    

    If you’re running MyISAM you risk things ending up in a partially completed state this way or yours. If your running innodb and want to maintain the all or nothing aspecs of a transaction you’ll have to wrap that loop in a begin/commit. But, then you’ll have the deal with the fallout of having potentially overlly large transactions.

    If you can provide more details on your specifics I can go deeper down that route.

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

Sidebar

Related Questions

I have a table, which holds (besides all other data) information, when this data
So I have this temp table that has structure like: col1 col2 col3 col3
I have a python ndarray temp in some code I'm reading that suffers this:
Say I have this great query in my stored procedure. Select * from Temp
I have 2 procedures. One that builds a temp table and another (or several
I currently have multiple queries that query data from a few tables linked through
I have some code that disables a trigger on a table, runs an update,
I have a temp table I am creating a query off of in the
I have a table that was created using this mysql statement below. CREATE TABLE
I have a proc that inserts records to a temp table. In pseudocode it

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.