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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:46:28+00:00 2026-06-05T07:46:28+00:00

Given a numeric secondary index in Riak I can do range queries, like: Find

  • 0

Given a numeric secondary index in Riak I can do range queries, like:

“Find me all values* with index “sn” between 1 and 10″.

Is there a way to find the maximum value for a numeric index? I.e.

“Find me a maximum value of index “sn”.

* It actually finds all primary keys (not the values themselves), but here it does not matter.

  • 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-05T07:46:29+00:00Added an answer on June 5, 2026 at 7:46 am

    No, you can’t ask Riak to give you the maximum value for the 2i. You will have to execute a map/reduce job and parse each 2i value which includes a reduce job to find the maximum.

    If this is an important part of your application there are other ways you can get around the problem. Once you find the maximum you can add a secondary index to the value which indicates that it’s the maximum. If the maximum value changes over time you could:

    • Map/reduce over the bucket where the 2i for maxval_int is 1.
    • If there’s only one result, return it.
    • If there are multiple results, reduce to find the max.
    • Remove the maxval_int index from each object that is no longer the maximum.
    • When adding new values check against the current maximum value, update indexes accordingly.

    The little read-repair-like function is there to handle cases where nodes in your cluster are partitioned.

    HTH.

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

Sidebar

Related Questions

Given is an array of three numeric values and I'd like to know the
I need to export some numeric values from a given ASCII text file and
Given a directory of files all with numeric names, I currently sort and filter
Given a list of assorted length words, what is the best way to find
Given a type T , is there any way to write something equivalent of
Given XML where FORMNUMBER can be numeric only; begin with numeric and then include
New to Play, looks like one can apply numeric constraint to Ints and Longs,
The task is to generate a given number of numeric pins of a given
Given the following conditions: two BigDecimal values: b1 and b2 ; x - Integer;
Given the above dynamically generated text (meaning that I can't just use an image),

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.