>>12586👍 Thanks anon! There's more:
I want to see the board as it was a year ago. I need to get all of the threads that were on the board, at t = (now - 1 year).
Threads are ordered by bump time. We need to get the first, say, 400 threads if you order all the threads by bump time.
In lainchan each thread has a bump column (threads and posts share the same table called posts_a or whatever), which makes it simple to get the current top threads, but it doesn't help us calculate what the bump times were one year ago.
So first I recognize that a thread's bump time is just the time the most recent post was posted to that thread.
Maybe I can use SQL's aggregate function to get the MAX post creation time, if we group the posts by their thread_id. Then, since I have indices on the creation_time and thread_id columns, (and another index on both), if I limit the number of threads that I want then hopefully this won't be slow:
SELECT
threads.thread_id,
Post too long. Click here to view the full text.