TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Is there a datastructure for leaderboards with filtering and timeslices?

2 pointsby JoeOfTexas7 months ago
I built a variation of B+Tree to track leaderboard rankings and it works similar to Redis Z functions (zadd&#x2F;zrange).<p>Now I&#x27;m trying to think of a solution to filter by country code or some other player attribute. In addition, I also want to dynamically create timeslices so I can show leaderboard rankings that occurred between time A and time B.<p>If I were to implement the filter or timeslices into my B+Tree, I&#x27;d have to basically scan from the first record down to the last by checking against player attributes and&#x2F;or the timestamp of when ranking was inserted.<p>The goal is to have 1 leaderboard index per stat, rather than X leaderboard per stat.<p>Is it feasible, or should I just create a new leaderboard index for every combination of attribute &#x2F; timeslice?

1 comment

solardev7 months ago
Are you at the scale where a simple database table and a few queries can&#x27;t solve this?<p>Maybe I&#x27;m misunderstanding something, but if it&#x27;s just a few thousand&#x2F;tens of thousands of entries, it seems like the kind of thing any SQL can do pretty effortlessly...?
评论 #42056064 未加载