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
7839
March 18, 2009 02:43AM
2876
March 18, 2009 03:08AM
2735
March 18, 2009 08:29PM
2690
March 19, 2009 04:48AM
2853
March 19, 2009 10:46AM
2604
March 19, 2009 03:47AM
2746
March 19, 2009 03:55AM
2624
March 19, 2009 04:49AM
2593
March 19, 2009 10:20AM
2284
March 30, 2009 01:25AM
2347
March 30, 2009 07:13PM
2421
March 31, 2009 02:31AM
2647
March 31, 2009 08:12AM
2269
April 01, 2009 03:27AM
Re: InnoDB CPU Spikes
2399
April 01, 2009 10:01AM
2455
April 01, 2009 10:22AM
2295
April 01, 2009 03:45AM
2607
April 01, 2009 11:57PM
2517
April 06, 2009 01:23AM
2472
April 06, 2009 08:01PM
2264
April 07, 2009 12:14AM
2400
April 08, 2009 04:36PM
2393
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.