[SOLVED] Query fix (speed up)

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 07-31-2008, 03:15 PM
peppolone's Avatar
Pligg Dev
Pligg Version: 1.1.0
Pligg Template: upnews.it
 
Join Date: Dec 2006
Location: rome
Posts: 187
i saw there was always one query in my db
Code:
SELECT link_id, count( link_id ) AS count FROM pligg_links, pligg_categories WHERE category_lang = 'en' AND category_id = link_category GROUP BY link_category ORDER BY category_name ASC ;
it takes about 1 second and resides in the file /libs/html1.php
i removed the line
Code:
$sql = "select *,  count(*) as count from " . table_links . ", " . table_categories . " where category_lang='$dblang' and category_id=link_category group by link_category ORDER BY category_name ASC";
and now my site is very fast, this is the best fix i found.
i know it is for categorylist, but all in my sidebar works fine, i think it is an old query, i found it only in pligg 8.0 into categories.tpl
{section name=nr loop=$categorylist}
now we have loop=$cat_array
sry for my english

Last edited by peppolone; 07-31-2008 at 04:05 PM.
Reply With Quote
  #2 (permalink)  
Old 08-01-2008, 10:03 AM
xiesi's Avatar
Constant Pligger
Pligg Version: 9.95
Pligg Template: yget + diy
 
Join Date: Jun 2007
Posts: 223
Send a message via MSN to xiesi
yes!!Affter i removed is very fast.thanks
Reply With Quote
  #3 (permalink)  
Old 08-01-2008, 10:46 AM
New Pligger
 
Join Date: Jul 2008
Posts: 28
Did you remove all the 3 lines?

PHP Code:
$sql "select *,  count(*) as count from " table_links ", " table_categories " where category_lang='$dblang' and category_id=link_category group by link_category ORDER BY category_name ASC";
$categorylist object_2_array($db->get_results($sql));
$var_smarty->assign('categorylist'$categorylist); 
Reply With Quote
  #4 (permalink)  
Old 08-01-2008, 11:27 AM
peppolone's Avatar
Pligg Dev
Pligg Version: 1.1.0
Pligg Template: upnews.it
 
Join Date: Dec 2006
Location: rome
Posts: 187
Quote:
Originally Posted by TypeEE View Post
Did you remove all the 3 lines?

PHP Code:
$sql "select *,  count(*) as count from " table_links ", " table_categories " where category_lang='$dblang' and category_id=link_category group by link_category ORDER BY category_name ASC";
$categorylist object_2_array($db->get_results($sql));
$var_smarty->assign('categorylist'$categorylist); 
yes remove all categorylist.
thank me on the first post if you like my fix.
Reply With Quote
  #5 (permalink)  
Old 08-01-2008, 11:49 AM
New Pligger
 
Join Date: Jul 2008
Posts: 28
Thank you!!!
Reply With Quote
  #6 (permalink)  
Old 08-01-2008, 04:23 PM
Yankidank's Avatar
Pligg Founder/Coder/Designer
Pligg Version: SVN
Pligg Template: Wistie
 
Join Date: Dec 2005
Location: Ocala, FL
Posts: 4,934
Send a message via AIM to Yankidank
Added to Pligg SVN.

The Twitter Module for Pligg CMS!
Register, Login, and Submit Stories with Twitter. An absolute MUST HAVE for all Pligg sites!
Reply With Quote
  #7 (permalink)  
Old 08-01-2008, 05:35 PM
peppolone's Avatar
Pligg Dev
Pligg Version: 1.1.0
Pligg Template: upnews.it
 
Join Date: Dec 2006
Location: rome
Posts: 187
when can i find my name into the code lol
Reply With Quote
  #8 (permalink)  
Old 08-01-2008, 06:48 PM
Pligg Donor
 
Join Date: Jul 2007
Posts: 286
thanks. After I remove the code you suggested, my site is fast.
Reply With Quote
  #9 (permalink)  
Old 10-05-2008, 03:40 PM
ArturOzimek's Avatar
Casual Pligger/Coder
 
Join Date: Jul 2008
Posts: 38
My site is much faster as well. well done.thanks
Reply With Quote
  #10 (permalink)  
Old 10-05-2008, 04:44 PM
New Pligger
 
Join Date: Jul 2008
Posts: 10
Thanks so much for this , this really helps
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Found a way to speed up pligg tonuonu Questions and Comments 10 04-13-2008 06:42 PM
The Real Cause Of High Load For My Server Using PLigg 9.9 and Was 9.8.2 argh2xxx Questions and Comments 18 01-10-2008 05:33 PM
Custom Query.. But How? borbor Questions and Comments 3 12-09-2007 11:06 PM
'max_user_connections' suddenly exceeded mightyb Questions and Comments 10 06-13-2007 05:40 PM
Reducing query count in comments revenazb Questions and Comments 5 04-17-2007 01:37 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development