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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:47:37+00:00 2026-05-27T13:47:37+00:00

I have an InnoDB table with a lock timeout column. If this column is

  • 0

I have an InnoDB table with a lock timeout column. If this column is null there is no lock, otherwise there is a lock that times out according to the timestamp in that column.

The problem I am having is that there is alot of rows in this table, and many rows in this table are getting processed each minute, but the processing is currently following this model:

1. select rows to be processed
2. iterate over rows to be processed in Java
     a. Try to acquire a lock on row
     b. if lock acquired, process row and continue; else continue

This gets inefficient really fast, so it would be great if I could instead just try to acquire a lock on all the rows to be processed, and then return the result set of rows for which the lock was acquired all in one transaction or a few more efficient transactions.

What would you recommend?

  • 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-27T13:47:38+00:00Added an answer on May 27, 2026 at 1:47 pm

    select only the rows which a lock can be acquired, using a where clause in your sql like

    where lock_timeout is null
    

    Also, I hope if this has multiple threads, that you put a mutex or something on this whole section of code. Everything from selecting the rows, until the locks are made.

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

Sidebar

Related Questions

I have an InnoDB table that lists customer orders - this table records the
I have a MySQL InnoDB table with a status column. The status can be
I have a MySQL InnoDB table laid out like so: id (int), run_id (int),
I have an InnoDB table containing users, like this: +--------------+-----------------------+ | user_id | name
We have a (currently InnoDB) table which contains roughly 500,000 rows. This represents a
I have a table in MySQL 5 (InnoDB) that is used as a daemon
I have a schema that uses InnoDB table type and foreign keys. I am
I have read several times that after you delete a row in an InnoDB
I have a InnoDB table that has about 17 normalized columns with ~6 million
I have the following InnoDB table: +-----------+-----------+------+-----+-------------------+----------------+ | Field | Type | Null |

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.