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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:52:21+00:00 2026-06-04T20:52:21+00:00

I need to optimize the read/write count for a POST request that I’m using.

  • 0

I need to optimize the read/write count for a POST request that I’m using.

Some info about the request:

  • The user sends a JSON array of ~100 items
  • The servlet needs to check if any of the received items is newer then its counterpart in the datastore using a single long attribute
  • I’m using JDO

what i currently do is (pseudo code):

 foreach(item : json.items) {
     storedItem = persistenceManager.getObjectById(item.key);
     if(item.long > storedItem.long) {
         // Update storedItem
     }
 }

Which obviously results in ~100 read requests per request.

What is the best way to reduce the read count for this logic? Using JDO Query? I read that using “IN”-Queries simply results in multiple queries executed after another, so I don’t think that would help me 🙁

There also is PersistenceManager.getObjectsById(Collection). Does that help in any way? Can’t find any documentation of how many requests this will issue.

  • 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-04T20:52:22+00:00Added an answer on June 4, 2026 at 8:52 pm

    I think you can use below call to do a batch get:

    Query q = pm.newQuery("select from " + Content.class.getName() + " where contentKey == :contentKeys");   
    

    Something like above query would return all objects you need.
    And you can handle all the rest from here.

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

Sidebar

Related Questions

Need some advice on how to optimize my articles table for read operations. I
I am have a lot of code that I need to optimize and make
I need to write the expression meaning optimize over the parameter set . I
Read the edit below for more information. I have some code below that I
I need to optimize our web service, but don't know where to begin. We're
I'm in a need to optimize this really tiny, but pesky function. unsigned umod(int
Need some help understanding the difference between the success and ajaxSuccess events documented here
Every time I write trivial getters (get functions that just return the value of
I need to have a class with one activity that is performed once per
I need to search a text field (varchar 500) on a table with about

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.