View Single Post
08-09-2010, 06:13 PM   #1
Jeff
Administrator
 
Jeff's Avatar
 
Join Date: Jul 2010
Posts: 402
Rep Power: 10
Jeff is getting browny points
When Indexes Attack

I have been having a problem with one MySQL server lately that is hosting a few databases but one in particular with millions of rows of Vbulletin posts and threads. During some queries it would hang in a "Copying to tmp table" state. This was driving me crazy. I could isolate the query and although it was not the most efficient one it should not have bogged things down this bad. After much searching I came across this guys post who was having the same problem.

I began checking the table designs for the post and thread tables and sure enough there were some non-standard indexes there. There have been a few previous administrators of this database so it is quite possible they modified it in the past. I saw many duplicate indexes and removed the ones that did not come stock with VB. Restarted mysql and rebuilt the tables. The query that would take 500 seconds to complete was now finishing in under 2 seconds.

If you are having this problem and are lost, CHECK YOUR INDEXES!
Jeff is offline   Reply With Quote