slaent / issues

http://slaent.com
6 stars 1 forks source link

Messages Improvements #63

Closed todesignandconquer closed 8 years ago

todesignandconquer commented 8 years ago
pythonesque commented 8 years ago

So long as we ensure that private messages are all nested at most one level deep (i.e. each thread has a single parent shared by everyone), finding the thread for a post is as simple as a single self join from the post to its parent. Therefore, to find the most recently updated PMs, we simply need to order by descending post id, join to the parent, and use a loose index scan to get the first n distinct values efficiently (this is the same technique we should be using on the front page). There's a slight complication because we need to not join the first post in a thread, but that seems easy enough to deal with.