FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups  Who is OnlineWho is Online   Join! (free) Join! (free)  
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  • Welcome
  • Guest

Faster forums part five

 
Post new topic   Reply to topic    myfreeforum.org Forum Index -> Forum Blogs
View previous topic :: View next topic  
Author Message
myff admin
Site Admin
Site Admin
FLAG

Virtual Cash: 92890

Joined: 22 May 2005
Posts: 32203



Add Karma

rated by 281 members
Add Comment
Show Comments


online/offline
PostPosted: Sat Aug 22, 2009 12:13 pm    Post subject: Faster forums part five  Reply with quote

This one requires a little archeology.  We are running non standard code to clear out old search results, and I can't quite fathom why at the minute.

But the principle here is that every search on a phpbb2 forum does the work of clearing down old results. This in entirely unnecessary.  Sure it needs doing, but not on every search.

I have implemented this on downsizer (which runs the standard code) and "View Latest Posts" is noticeably nippier
_________________

Family Friendly Shareware | | Web Design/Services | Free Forums
Back to top
View user's profile Send private message Visit poster's website
myff admin
Site Admin
Site Admin
FLAG

Virtual Cash: 92890

Joined: 22 May 2005
Posts: 32203



Add Karma

rated by 281 members
Add Comment
Show Comments


online/offline
PostPosted: Sun Aug 23, 2009 12:23 pm    Post subject: Reply with quote

That change went in yesterday, todays change replaces a query:

Code:

         $sql = "SELECT COUNT(user_id) AS total
            FROM " . USERS_TABLE
            WHERE user_id <> " . ANONYMOUS . ";

            break;


with:


Code:

         $sql = "SELECT COUNT(user_id) AS total
            FROM " . USERS_TABLE;

            break;


Since there is only ever one user with the ANONYMOUS id, we really don't need to run a straight forward row count into something that makes the database have to do any work, even if the work is minimal given the way the index will operate.
_________________

Family Friendly Shareware | | Web Design/Services | Free Forums
Back to top
View user's profile Send private message Visit poster's website
myff admin
Site Admin
Site Admin
FLAG

Virtual Cash: 92890

Joined: 22 May 2005
Posts: 32203



Add Karma

rated by 281 members
Add Comment
Show Comments


online/offline
PostPosted: Sat Aug 29, 2009 9:51 am    Post subject: Reply with quote

Continuing the hunt for poor database queries in some instances a user may visit a forum link having presumably just registered, at any rate with their user_lastvisit at zero.

Code:

$sql = "SELECT t.forum_id, t.topic_id, p.post_time
         FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
         WHERE p.post_id = t.topic_last_post_id
            AND p.post_time > " . $userdata['user_lastvisit'] . "
            AND t.topic_moved_id = 0";


to determine new topics can then take an age to complete  

Many moons ago I fixed a similar absurdity on the index page, and I have now added this :

Code:

      // 60 days limit
      if ($userdata['user_lastvisit'] < (time() - 5184000))
      {
         $userdata['user_lastvisit'] = time() - 5184000;
      }


to stop the problem on viewing a forum.
_________________

Family Friendly Shareware | | Web Design/Services | Free Forums
Back to top
View user's profile Send private message Visit poster's website
myff admin
Site Admin
Site Admin
FLAG

Virtual Cash: 92890

Joined: 22 May 2005
Posts: 32203



Add Karma

rated by 281 members
Add Comment
Show Comments


online/offline
PostPosted: Sat Aug 29, 2009 10:35 am    Post subject: Reply with quote

taking this further the new topics query is actually redundant in index.php as the info is available already. So that has now been removed.


_________________

Family Friendly Shareware | | Web Design/Services | Free Forums
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    myfreeforum.org Forum Index -> Forum Blogs All times are GMT
Page 1 of 1
 
 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Card File  Gallery  Forum Archive
Powered by phpBB © 2001, 2005 phpBB Group
Create your own free forum | Buy a domain to use with your forum