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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:53:20+00:00 2026-05-24T01:53:20+00:00

I have a lot of data in a database(PostgreSQL) and need to process all.

  • 0

I have a lot of data in a database(PostgreSQL) and need to process all. My program have threads to process all these data and follows these logic.

  1. Get a part of data from database
  2. Process
  3. Save data

I have doubt about how is best way to do this. I have three ideas:

  • Create a manager class that runs in a loop getting data from database and holding a queue of objects to process. Create a process class that runs in a loop getting the object to process from the manager class.

  • To de same above, but without the manager class, so the process class will have the queue of objects shared between it and they will be responsible for getting the data from database too.

  • A manager class that runs in a loop getting data from database, but it create the process classes with the data to process, so the process class won’t request nothing from the manager. It’s created, processed and destroyed, and not run in a loop.

I don’t know what is better, and if there is another solution more efficient.

  • 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-24T01:53:21+00:00Added an answer on May 24, 2026 at 1:53 am

    You are describing so called manager-worker model. I think that your first description is better.

    It pushes data into a queue and multiple workers process it. You can use thread pool for workers. The workers are waiting on queue. Once work is pushed to queue one of the workers takes it immediately. When they are done they can push the result into outgoing queue and yet another thread will send the data to DB. Alternatively each worker can save results himself. It is up to you and depends on your task.

    User Excecutors and BlockingQueue for implementation. All you need is in java.util.concurrent package and you can find a lot of tutorials and example in web how to use them.

    Good luck.

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

Sidebar

Related Questions

I need to have a lot of user data in the database. Now, I've
dear all. i have a lot of data in my database. after that i
We have a large database with a lot of data in it. I found
I have a database with a lot of old phpBB data that contains posts
I have a database with a lot of old phpBB data that contains posts
I have a lot of data-entryists using my ASP.NET application and we have all
I have a process that imports a lot of data (950k rows) using inserts
I have a PostgreSQL database which contains a lot of rows ~160,000,000. The database
Suppose that, I use Oracle database. If my table have a lot of data
My conundrum is as follows. I have a lot of data stored in various

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.