31 sats \ 3 replies \ @k00b 3 Apr 2022 \ parent \ on: Daily discussion thread
So happy.
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).
What’s the difference better post and recent?
reply
Do you mean top? Recent are recent posts (sorted by time). Top are the posts that did the best for a give period of time
Post takes you to a form to create a new post
reply
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
- denormalizing some of the notifications
reply