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

  • Home
  • SEARCH
  • 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 7526059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:43:47+00:00 2026-05-30T03:43:47+00:00

Is there a way without using a script to run an UPDATE that won’t

  • 0

Is there a way without using a script to run an UPDATE that won’t slow the DB by only doing a certain amount of rows at a time?

I’m performing

UPDATE .. SET .. FROM .. INNER JOIN .. ON ... WHERE

and it’s going to update 3,171 rows in a very large table.

I don’t want to lock the DB or slow it down. Any ideas?

NOTE:

As per the MySQL docs for UPDATE: For the multiple-table syntax, UPDATE updates rows in each table named in table_references that satisfy the conditions. In this case, ORDER BY and LIMIT cannot be used.

I was performing an INNER JOIN and LIMIT was not allowed to be used, using LIMIT as a solution does not work in this case.

  • 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-30T03:43:49+00:00Added an answer on May 30, 2026 at 3:43 am

    Believe it or not, you can use LIMIT!

    UPDATE mytable SET ... WHERE ... LIMIT 10;
    

    I know it sounds weird, and it is non-deterministic, but it’s so handy!

    Edit

    However, for updating joins, limit is not supported. However, there is an solution!

    Use variable to control how many rows are updated. Here’s a general look at how it works:

    set @i := 0;
    update table1 t1
    join table2 t2 on t1.keycol = t2.keycol and (@i := @i + 1) < 100
    where t1.col != 'someval'
    set t1.col = 'someval';
    

    Here I’m updating the first/next 100 rows that match the join criteria – you can set it to whatever number you like.

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

Sidebar

Related Questions

Is there a way how to run MATLAB script from specific line without using
Is there a way to run a shell script using Spotlight on Mac OS
Is there a Python way without using a subprocess to clone a git repository?
Is there a way (without installing any libraries) of validating XML using a custom
Is there any way to deploy an item without using this attribute ? I'm
Is there any way to accept POST type requests without using Nerve lib in
Is there any way to check whether a file is locked without using a
Is there a way to add some custom font on a website without using
Is there a way to use Enum values inside a JSP without using scriptlets.
Is there a way to create WCF proxy objects on the fly without using

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.