Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

Multiple "last"/Recent Topics per Board on Forum Index

Aloittaja medicMe, joulukuu 21, 2013, 05:48:03 IP

« edellinen - seuraava »

medicMe

You know how the forum shows the latest post on the forum index page per board (on the far right column for most themes / default theme)?

How could I go about showing the latest 4-5 posts in that field instead of just the last post? Like a mini list of recent posts per board displayed on the board index?

Is there a mod or tip/trick for that?

If not, could I use SSI on the board index page theme/template to accomplish this?

Thanks!

Arantor

There is no way to do that without an *insane* performance overhead.

You would add a query to the board index for every single board being displayed. None of which are fast.
Holder of controversial views, all of which my own.


medicMe

Lainaus käyttäjältä: Arantor Beeblebrox the First - joulukuu 21, 2013, 07:07:36 IP
There is no way to do that without an *insane* performance overhead.

You would add a query to the board index for every single board being displayed. None of which are fast.

That makes sense. But isn't there already a query being done for each board anyway? I mean, if we did it through SSI, then yeah, I'd expect the new overhead to be higher. . .  but we have a 'latest post' column being populated for each board as it is, so can that query be extended to include the latest 3-5 posts without jacking up the overhead that much?

(Of course, I'm saying this without having looked up how that one query is made in the first place, so maybe I'm overlooking something obvious.)

Arantor

No, there is not one query per board currently. There is one query for the overall board index as a whole - the last message in each board is stored per board already so it's an easy query with simple joins, without having to do any queries to actually sort or fetch anything.

So, no, you can't just extend that query because it doesn't record the last 3 to 5 topics per board, it stores the last message id. And no, you can't store the last 3-5 per board because every time there was a post in that board, you'd have to modify each of those ids as well, and then create multiple table joins which is also insane.

But doing the query you're talking about is not going to be particularly fast. Whether you do it of the last 5 updated topics, or the last 5 posts (which may be 5 different topics or one overall topic), either way there are covering indexes but that's still a query per board because there's no way to fetch a group of the top x items per group, without doing separate queries per group, i.e. one query per board for every board you will be showing to users.
Holder of controversial views, all of which my own.


medicMe

Thank you for your insight... I really appreciate the detailed response. :)

In the interest of avoiding scaling and performance issues on the board index page, I probably won't go down the SSI route and/or multiple queries...

Last question though: On my home page (site home page, not the forum index) I have used the SSI functions to create a list of recent topic activity, does this action do the same type of multiple queries as what you described?

(I'm using the array variable method with ssi_recentTopics.)

Arantor

No, that's just one query across all boards. It's only when you want "last x with xyz criteria" that you need multiple queries, I.e. "last x topics from board 1" then "last x topics from board 2"
Holder of controversial views, all of which my own.


medicMe

Thanks again. Your answers were very clear and informative. Even though my objective won't be met, I feel like I learned a bit and it was worth investigating. :)


Advertisement: