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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:31:42+00:00 2026-06-11T23:31:42+00:00

I have a very big list of element in my non-sql database. Every element

  • 0

I have a very big list of element in my non-sql database.

Every element has a sort order from 1 to N. This sort order specifies how the results appear on the forms.

When in the UI triggers a change of order (put element i in position j) I need to update all the entities between. If the element 1 becomes the lastest, I need to make N updates.

Is there an efficient way to make this operation less costly? Is there an smart way to index the sort value?

Some considerations:

  • I’m re-designing my application so I can afford to reindex the entities with a smarter solution.
  • The cost of a write (update) is +-4 times bigger than a fetch (read 1 entity).
  • The list is big, does not fit in memory.
  • 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-11T23:31:43+00:00Added an answer on June 11, 2026 at 11:31 pm
    1. Reindex your entities. Set order property to double.
    2. Every time a user moves an entity to a new position, assign it a new order property between the other two entities:

      entityA.setOrder((entityB.getOrder() + entityC.getOrder())/2);

    3. Save entity A (property “order” should be indexed).

    4. When a user requests entities from 10000 to 10200, build a Query on your order property with a sort order. Retrieve results from 10000 to 10200:

      datastore.prepare(q).asList(FetchOptions.Builder.withOffset(10000).limit(200));

    5. Never reindex your entities again. Datastore does it for you every time you save an entity.

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

Sidebar

Related Questions

I have a very big CSV file (1GB+), it has 100,000 line. I need
I have an element which may contain very big amounts of data, but I
I have a very big problem solving this issue I have 2 tables first
Suppose I have a list in sml which is very big then sml shows
I have a big list of Twitter users stored in a database, almost 1000
I have a very big list of 0's and 1's that are represented as
I have very very big html page/data. I need to fetch data under h1
I have a very big hadoop sequence file in the hdfs. what is the
I have a very big workflow, it's using the framework 4. Some workflow can
I have a very big problem. I am making a CRM (Costumer Relationship Management)

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.