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
7417
March 18, 2009 02:43AM
2750
March 18, 2009 03:08AM
2620
March 18, 2009 08:29PM
2575
March 19, 2009 04:48AM
2728
March 19, 2009 10:46AM
2504
March 19, 2009 03:47AM
2654
March 19, 2009 03:55AM
2521
March 19, 2009 04:49AM
2492
March 19, 2009 10:20AM
2195
March 30, 2009 01:25AM
2270
March 30, 2009 07:13PM
2295
March 31, 2009 02:31AM
2521
March 31, 2009 08:12AM
2193
April 01, 2009 03:27AM
Re: InnoDB CPU Spikes
2243
April 01, 2009 10:01AM
2352
April 01, 2009 10:22AM
2224
April 01, 2009 03:45AM
2507
April 01, 2009 11:57PM
2403
April 06, 2009 01:23AM
2364
April 06, 2009 08:01PM
2145
April 07, 2009 12:14AM
2297
April 08, 2009 04:36PM
2316
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.