strager / First

GNU General Public License v3.0
3 stars 2 forks source link

Leaderboard database table #6

Closed strager closed 1 year ago

strager commented 1 year ago

Redemption table:

Methods:

mate-amargo commented 1 year ago

Redemption table:

                "CREATE TABLE IF NOT EXISTS "
                "redemptions("
                    "broadcaster_id, "
                    "reward_id UNIQUE, "
                    "user_id, "
                    "redeemed_at, "
                    "level"
                ")"
mate-amargo commented 1 year ago

Done in commit 0925835. Some notes:

@strager thoughts?

strager commented 1 year ago

Will this scale up? I'm adding all the points using the SUM call in sqlite, will that query be too slow when we have a big db? if so, how can we make it faster?

It won't scale to a billion rows, but it should be fine with a million rows. 1 million redemptions / 3 redemptions per stream per day / 1 year = 913 streams

We could also have a method returning a list of tuples containing the sum of points per streamer for a given user.

I think this is a good idea, but not for MVP.