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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:08:13+00:00 2026-06-04T21:08:13+00:00

I have a MySQL table with 237 million rows. I want to process all

  • 0

I have a MySQL table with 237 million rows. I want to process all of these rows and update them with new values.

I do have sequential ID’s, so I could just use a lot of select statements:

where id = '1'
where id = '2'

This is the method mentioned in Sequentially run through a MYSQL table with 1,000,000 records?.

But I’d like to know if there is a faster way using something like a cursor that would be used to sequentially read a big file without needing to load the full set into memory. The way I see it, a cursor would be much faster than running millions of select statements to get the data back in manageable chunks.

  • 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-06-04T21:08:14+00:00Added an answer on June 4, 2026 at 9:08 pm

    Ideally, you get the DBMS to do the work for you. You make the SQL statement so it runs solely in the database, not returning data to the application. All else apart, this saves the overhead of 237 million messages to the client and 237 million messages back to the server.

    Whether this is feasible depends on the nature of the update:

    • Can the DBMS determine what the new values should be?
    • Can you get the necessary data into the database so that the DBMS can determine what the new values should be?
    • Will every single one of the 237 million rows be changed, or only a subset?
    • Can the DBMS be used to determine the subset?
    • Will any of the id values be changed at all?

    If the id values will never be changed, then you can arrange to partition the data into manageable subsets, for any flexible definition of ‘manageable’.

    You may need to consider transaction boundaries; can it all be done in a single transaction without blowing out the logs? If you do operations in subsets rather than as a single atomic transaction, what will you do if your driving process crashes at 197 million rows processed? Or the DBMS crashes at that point? How will you know where to resume operations to complete the processing?

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

Sidebar

Related Questions

I have a MySQL table and I want to extract all rows except if
I have the MySQL table with 2 rows that is name for user name
I have a MySQL table which contains a list of all possible products a
I have a MySql table which has about 100k rows. there is one field
I have these mysql table, ------------------------------------------------------------------- | products_id | date_added | date_modified | |
I have a mySQL table which contains rows based on payments. Each row contains
I have a mysql table which on any change (i.e. insert, update and delete)
I have a mysql table that has a number of rows, and in each
I have a mysql table, I want to check if a row exists where
I have a MySQL table with approximately 3000 rows per user. One of the

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.