News:

Wondering if this will always be free?  See why free is better.

Main Menu

Why is counting posts so SQL intensive?

Started by machmanx, October 25, 2008, 12:05:00 PM

Previous topic - Next topic

machmanx

Right now, the number of levels the counter can count is limited to a max of 3.  I was wondering how this feature was implemented so that perhaps I can think of a better way to implement such a count feature.  It just seems to me that counting, which is adding shouldn't be much of an issue for today's processors that can do millions and millions of additions per second.

Anyway, I'd like to know how the count feature is implemented.

Rumbaar

I'm not sure what you are talking about?  Max of 3?

Now as for processors, etc. When you're hosted on a shared server with a number of users trying to fight for allocated resources it can put a load on the whole server if it's not managed well.  Hence limiting unnecessary load on a server is an important feature.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

青山 素子

Quote from: Rumbaar on November 03, 2008, 08:27:44 PM
I'm not sure what you are talking about?  Max of 3?

Poster is talking about grandchild-board post stats.

Basically, the problem isn't so much addition as recursion. You'd need to run two new SQL queries for each child board all the way down (one to find children of the current, then one for the post count total). If you have a deeply-nested structure then this can get very intensive quickly. Limiting the depth of the statistics is a good compromise between statistic collection and resource-friendliness.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


machmanx

I see.  Still, it's kinda annoying to see a Parent Topic show 8 topics, 1 post when most of the topics and posts are like 4 levels down instead of 3.  This is the max I'll need, just 4 levels down.  Most of my topics are only 3 or less levels.

I wanna experiment with the SQL count.  If it won't make it waaay worse, then how do I change the count level from 3 to 4?



Katrynya

Where is this annoying thing that I might edit it!!!!
I understand the need for the compromise, however, I would like to adjust it myself to the number of generations best suited to my board.
I purpose to do this by changing the limit on the number of generations, and keeping track of how long pages take to load.


~ Katrynya

Arantor

QuoteWhere is this annoying thing that I might edit it!!!

When you've overhauled how board access works, followed by rewriting the entirety of Subs-BoardIndex.php to work differently, the limit can be taken away...

You can't just remove the limiter, it still won't work like that, you have to rework the code that handles the results.

Advertisement: