Joomla! Discussion Forums



It is currently Tue Nov 24, 2009 4:42 pm (All times are UTC )

 


Forum rules

Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Security and Performance FAQs
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: new optmization need
Posted: Mon Apr 16, 2007 7:50 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Mon Nov 06, 2006 1:14 pm
Posts: 11
I made an alteration that significant improves the processing of the database. my table mos_core_log_itens have 230,000 contents only one simple update of hit+1 made a consultation in the 230 a thousand registers after I to create one INDEX keys  in ( time_stamp, item_id ) fields, making with that the mysql now read only 17 rows. I had a very good result.

UPDATE mos_core_log_items
SET hits = ( hits + 1 )
WHERE time_stamp = '2007-04-16'
AND item_table = '#__content'
AND item_id = 14316;

without INDEX keys :  7,0241 seg
with INDEX keys : 0.002 seg

It's very very good for performance in big database;


Last edited by nei_rauni on Mon Apr 16, 2007 7:53 pm, edited 1 time in total.

Top
  E-mail  
 
 Post subject: Re: new optmization need
Posted: Mon Apr 16, 2007 8:45 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Aug 18, 2005 8:53 am
Posts: 711
Location: Switzerland
nei_rauni wrote:
I made an alteration that significant improves the processing of the database. my table mos_core_log_itens have 230,000 contents only one simple update of hit+1 made a consultation in the 230 a thousand registers after I to create one INDEX keys  in ( time_stamp, item_id ) fields, making with that the mysql now read only 17 rows. I had a very good result.

UPDATE mos_core_log_items
SET hits = ( hits + 1 )
WHERE time_stamp = '2007-04-16'
AND item_table = '#__content'
AND item_id = 14316;

without INDEX keys :  7,0241 seg
with INDEX keys : 0.002 seg

It's very very good for performance in big database;


full idex on all 3 values used in the where might bring even slightly better performances (even if 3rd might seem redundant: experienced that on a busy website being optimized together with MySQL engineers), as it becomes a "covered index" (means index and only index will be used always for sure) !

index ( time_stamp, item_id,  item_table )

OR, to make it also usable for searches by item_id and table (when left parts can be used for a query, the index will be used if the sql optimizer finds it "selective enough"):

index ( item_id,  item_table, time_stamp )

probably the latest is the one which makes most sense.

When creating this last index, don't forget to remove existing index on item_id, if there is one, to avoid duplicate indexes which damage performance.

_________________
Beat 8)
www.joomlapolis.com <= Community Builder + CBSubs Joomla membership payment system - team
hosting.joomlapolis.com <= Joomla! Hosting, by the CB Team


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 12 guests


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 post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group