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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:59:38+00:00 2026-05-31T07:59:38+00:00

If I want to have only the queries for: 1. Username, Xp, OtherUserData 2.

  • 0

If I want to have only the queries for:

1. Username, Xp, OtherUserData
2. User with the N-th highest Xp

How would I have to do the data structure and query.

For 1. I would have a structure similar to:
{ Username: { Xp, OtherUserData}}

Would I just have to do a query for 2. over all users, or is there a better option?

  • 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-31T07:59:39+00:00Added an answer on May 31, 2026 at 7:59 am

    I’m not completely sure what you are asking (is Xp the user’s score?), but here’s a guess:

    To store user data, create a row per user, keyed on their username (assuming this is unique and fixed) and then a column for each item:

    username ->  Xp      other    ...
                 value   value    ...
    

    To maintain a high-score table, use a single row (probably in a different column-family), with all users (or those above a certain threshold), with column names that are the scores, and specify a numeric (LongType) Comparator so that the columns are sorted by score:

    highscores -> 1000      1001      99999999   ...
                  user123   user345   user789    ...
    

    You can then retrieve the highest N scores by querying for the last or first N columns in this sorted row. You could remove low scores from this row if it gets too big.

    Update: As you point out, multiple users could have the same score. A quick-and-dirty solution would be to make the value a list of users:

    highscores -> 1000      
                  "user123, user567, user899"
    

    This is tolerable if you are unlikely to get large number of users with the same score, though awkward since you need to read, update, and write the list.

    You could use supercolumns, though these are not usually recommended.

    Otherwise you could probably use composite column keys so that you can distinguish users, but maintain columns sorted by score.

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

Sidebar

Related Questions

I want to have an only query with 2 queries but i don't know
I want to have the look of UITableViewCellStyleValue1 but instead of just only having
I want to filter the data in my SQL so that I only have
I Want to have only unique values in a SharePoin List. To achieve this
I have two sites with different SITE_IDs, but I want to have only one
I want to create a form using an unordered list ul must have only
i want a regular expression to validate string to have only text,operators and these
I want to have an event handler that executes only once and then unbinds
I want to have jquery-ui autocomplete automatically select the answer if there is only
I want to have a 2x2 grid with a buttons inside. This is only

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.