Something kind of neat about Stacker News daily earning that I didn't realize until after it was implemented: it's implicit staking. We could at some point increase the cost to post/comment and because those sats are redistributed to the most trusted users, they will get those sats back and more.
I made the front page query much faster yesterday after fixing 2 things:
removing the sub-query and replacing it with a join
fixing a hack that I implemented wrong and was causing the front page query to execute twice when loaded
I made comments much faster today by using a lateral join of the subquery instead of a normal join ... when using the normal join I had to compute the entire subquery (very expensive) , but with the lateral join I can filter the subquery for just the stuff that I want (children comments) ... I did still have to use a subquery because the comments query is recursive and you can't use aggregates in a recursive query (but you can in a subquery).
There are still 2 queries that can probably be improved a lot:
determining how much a user has stacked - we currently sum up all tips they've received to do this ... we should just denormalize this ... this will shockingly save us >50ms per request for mature users
Awesome idea, I'm all for it...
I love the concept of sharing the fees among users...
Thanks for such a brilliant platform...
Stacker News is the future...