Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-31-2007, 10:27 PM
New Pligger
Pligg Version: 9.8.2
Pligg Template: Default
 
Join Date: Oct 2007
Posts: 29
Thanks: 2
Thanked 17 Times in 3 Posts
A tip to speed up Pligg

I noticed that in the database there is no index on the link_status column in the pligg_links table. Almost every page load on the entire site includes 2 queries of this column, so adding an index on this column should provide a noticable improvement. I'm just launching my site now so I can't say how much, but it will definitely help. Once you have 1000+ stories in your Pligg site, having no index on this column has to be a killer.
Reply With Quote
The Following 13 Users Say Thank You to swiper For This Useful Post:
  #2 (permalink)  
Old 11-01-2007, 02:45 AM
Casual Pligger
 
Join Date: Sep 2007
Posts: 60
Thanks: 0
Thanked 2 Times in 2 Posts
This makes total sense. While I've done my share of php, I hadn't quite gotten into MySQL performance tweaks yet, but this seems consistent with everthing I've read.

When some more knowledgable dudes confirm it, I'll write a blog on PliggPower.com.

Thanks!

Brandon
Reply With Quote
  #3 (permalink)  
Old 11-01-2007, 05:56 AM
Constant Pligger
Pligg Version: 9.7
Pligg Template: Yget
 
Join Date: Nov 2006
Posts: 161
Thanks: 26
Thanked 1 Time in 1 Post
"Almost every page load on the entire site includes 2 queries of this column, so adding an index on this column should provide a noticable improvement."
Wow! so how does one go about solving this :-/
Reply With Quote
  #4 (permalink)  
Old 11-01-2007, 08:15 AM
AshDigg's Avatar
Coder
 
Join Date: Dec 2005
Posts: 1,574
Thanks: 235
Thanked 345 Times in 206 Posts
I'm going to work on the queries this weekend. Looking at the query.log there are a couple things that need to be worked on.
__________________
- Ash
Reply With Quote
The Following User Says Thank You to AshDigg For This Useful Post:
  #5 (permalink)  
Old 11-01-2007, 09:05 AM
New Pligger
Pligg Version: 9.8
Pligg Template: n/a
 
Join Date: Oct 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
It's a give and take scenario. It speeds up select queries, but if you're doing an update or insert, not only are you updating the data, but the database has to update the indexes as well. For all intents and purposes, this is generally a good idea. You figure for every record update for a semi busy pligg site, you're going to do 100-500 reads, so the overhead trade off on record updates is worth it, IMO.

I'm going to implement this myself shortly.

EDIT: I personally didn't see a major improvement, but it was noted. If somebody has time to do speed tests, I'd be interested.

Last edited by Atma; 11-01-2007 at 09:09 AM..
Reply With Quote
  #6 (permalink)  
Old 11-01-2007, 09:22 AM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 2,154
Thanks: 290
Thanked 266 Times in 177 Posts
Quote:
Originally Posted by Atma View Post
It's a give and take scenario. It speeds up select queries, but if you're doing an update or insert, not only are you updating the data, but the database has to update the indexes as well. For all intents and purposes, this is generally a good idea. You figure for every record update for a semi busy pligg site, you're going to do 100-500 reads, so the overhead trade off on record updates is worth it, IMO.

I'm going to implement this myself shortly.

EDIT: I personally didn't see a major improvement, but it was noted. If somebody has time to do speed tests, I'd be interested.
I was about to tell - I remember from my database classes at grad school, indexes are very optimal when you have more read than the number of inserts and updates, so if you take a simple Pligg site - it would normally have a huge pageview than less people actually voting, commenting and editing content - so I am sure indexes are gonna help us.
Reply With Quote
  #7 (permalink)  
Old 11-01-2007, 11:53 AM
New Pligger
Pligg Version: 9.8.2
Pligg Template: Default
 
Join Date: Oct 2007
Posts: 29
Thanks: 2
Thanked 17 Times in 3 Posts
nothingman - To add the index just issue the following in mysql (via your servers admin panel, SSH, etc):

alter table pligg_links add index(link_status);
Reply With Quote
The Following 3 Users Say Thank You to swiper For This Useful Post:
  #8 (permalink)  
Old 11-01-2007, 01:23 PM
Casual Pligger
 
Join Date: Sep 2007
Posts: 60
Thanks: 0
Thanked 2 Times in 2 Posts
Okay, so what's the verdict? Should everyone add an index or is this a case by case basis?

Brandon
Reply With Quote
  #9 (permalink)  
Old 11-01-2007, 01:27 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 2,154
Thanks: 290
Thanked 266 Times in 177 Posts
Please wait for a few days - Ash would be providing a significant update on the indexes and database optimizations - he has mentioned this at the top of this thread.
Reply With Quote
  #10 (permalink)  
Old 11-01-2007, 01:28 PM
Constant Pligger
Pligg Version: 9.7
Pligg Template: Yget
 
Join Date: Nov 2006
Posts: 161
Thanks: 26
Thanked 1 Time in 1 Post
Thanks swiper. Anything else I need to do? I have about 1800+ posts on my site
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
Pligg integration with SMF Forum autoinc Modification Tutorials 64 05-19-2008 02:22 AM


Search Engine Friendly URLs by vBSEO 3.2.0