MySQL Forums
Forum List  »  Performance

Re: InnoDB CPU Spikes
Posted by: Aftab Khan
Date: April 01, 2009 10:01AM

>Looks like the sorting is eating the CPU, also the explain shows "Using filesort", I am unable to add an index on the date column because it slows down my inserts and ultimately my >application crashes. The pk Id that I used was based on some query that I manually ran to get them, the application has no knowledge on these values.

### SQL
select hour(fldCreatedDate) RequestHour, fldshortcode as ShortCode, count(*) TotalRequests, sum(if(fldResponseType=true,1,0)) SuccessResponse, sum(if(fldResponseType=false,1,0)) AbortsAndErrors, count(distinct fldMsisdnnumber) TotalUniqueUsers from tblAuditLog where date(fldCreatedDate) = date('2009-03-04') group by RequestHour, ShortCode;

You have mentioned when you add an index on fldCreatedDate then it slows down your inserts. try to do batch inserts. if you don't add index on fldCreatedDate then it does slow down your Selects. Remember you can't get rid of filesort by adding index on `fldCreateDate`. Also if you do/did have index on `fldCreateDate` it wont be used because you have used date() function.

you have setup summary tables, which is good, do you archive the data after creating summaries?



Edited 1 time(s). Last edit at 04/01/2009 10:02AM by Aftab Khan.

Options: ReplyQuote


Subject
Views
Written By
Posted
8192
March 18, 2009 02:43AM
3004
March 18, 2009 03:08AM
2841
March 18, 2009 08:29PM
2790
March 19, 2009 04:48AM
2954
March 19, 2009 10:46AM
2742
March 19, 2009 03:47AM
2864
March 19, 2009 03:55AM
2736
March 19, 2009 04:49AM
2705
March 19, 2009 10:20AM
2387
March 30, 2009 01:25AM
2466
March 30, 2009 07:13PM
2535
March 31, 2009 02:31AM
2763
March 31, 2009 08:12AM
2365
April 01, 2009 03:27AM
Re: InnoDB CPU Spikes
2519
April 01, 2009 10:01AM
2567
April 01, 2009 10:22AM
2392
April 01, 2009 03:45AM
2726
April 01, 2009 11:57PM
2637
April 06, 2009 01:23AM
2595
April 06, 2009 08:01PM
2371
April 07, 2009 12:14AM
2511
April 08, 2009 04:36PM
2502
April 16, 2009 07:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.