ElkArte Community

Elk Development => Bug Reports => Topic started by: Jorin on August 06, 2014, 11:46:08 pm

Title: [RC2] recent posts
Post by: Jorin on August 06, 2014, 11:46:08 pm
Why are we having ten pages if there aren't any posts?  ;)

It's the link in info-center to all recent posts. My forum has only four posts till now, so here should be only one page.
Title: Re: [RC2] recent posts
Post by: emanuele on August 07, 2014, 06:05:26 am
hmm.. I thought this bug was present only for "big" forums, but probably we broke something at some point. lol

Long story: count (with JOINs and conditions) is one of the lowest things SQL does (because it has to "build" the entire set of records and then count each one of them until it reaches the end.
This particular count is one of the slowest of the entire code, for that reason if the forum is (I should say "should be") "big", ElkArte just sets the maximum number of entries it will display as "count" (i.e. 10 pages) as a shortcut to avoid having to run a very slow query and have the user wait for... dunno, several seconds (more) the page.

I'm not sure removing this altogether is "nice", it may impact on performances, one option that comes to my mind consists of removing the normal pagination and put just "prev | next" and then use some AJAX magic to fetch a "proper" pagination (cached).
Title: Re: [RC2] recent posts
Post by: Joshua Dickerson on August 07, 2014, 04:40:58 pm
AJAX for pagination makes sense.