Latest posts - multiple boards (General)

by Andy, Friday, October 30, 2015, 15:58 (3099 days ago) @ Auge
edited by Auge, Sunday, November 08, 2015, 12:59

Hi Auge

Ok, here is what I did in the end. You were right about the initial method slowing down because of the join, therefore I first created a view from these queries:

(SELECT id,pid,tid, user_id, UNIX_TIMESTAMP(TIME) AS TIME,UNIX_TIMESTAMP(TIME + INTERVAL 60 MINUTE) AS TIMESTAMP, subject, '#000066' AS color, 'board1' AS SOURCE FROM board1_entries WHERE pid = 0 ORDER BY TIME DESC LIMIT 1) UNION 
(SELECT id,pid,tid, user_id, UNIX_TIMESTAMP(TIME) AS TIME,UNIX_TIMESTAMP(TIME + INTERVAL 60 MINUTE) AS TIMESTAMP, subject, '#990000' AS color, 'board2' AS SOURCE FROM board2_entries WHERE pid = 0 ORDER BY TIME DESC LIMIT 1) UNION...

...and so on, for all the other boards. I decided to only to show completely new threads/posts, not replies.

And then I queried this view in index.inc.php with:

SELECT *, user_name FROM mlf_latest_entries LEFT JOIN mlf2_userdata ON mlf2_userdata.user_id = mlf_latest_entries.user_id ORDER BY time DESC LIMIT 10


Seems to work very well, with no time lag.

Thanks again for your help.


Complete thread:

 RSS Feed of thread