MySQL Forums
Forum List  »  Performance

Re: speed up query
Posted by: Rick James
Date: April 30, 2010 10:08AM

If you can devise an adequate set of Summary tables, then do the following when a batch comes in (twice a day):

1. Batch load into a new MyISAM table, say `tmp` with no indexes. (For HA, etc, the data can be reloaded.) (You will be doing only table scans, so don't bother with indexes.)

2. Run scripts to build summary info:
INSERT INTO Summary1 SELECT ... FROM tmp GROUP BY ...
Note: You have the luxury of doing this step with very little impact on what anyone else is doing.

3. If you really need the raw data,
INSERT INTO dsl_data SELECT * FROM tmp

4. DROP TABLE tmp.

Once the summary tables are in place, and the reports are hitting the summary tables, analyze which index(es) on the main table(s) can be dropped. (This will improve INSERT/DELETE performance on them.)

If your queries tend to be _exactly_ repeated several times a day, set query_cache_type = DEMAND, use SQL_CACHE in the SELECTs that might be repeated, and set query_cache_size to, say 400M. This will make _some_ of your queries instantaneous.

Doing all of the above should lead do a relatively idle system, and the report-type queries should be much faster than they currently are.

Options: ReplyQuote


Subject
Views
Written By
Posted
4145
April 18, 2010 06:42AM
1512
April 18, 2010 04:04PM
1593
April 18, 2010 05:40PM
1317
April 27, 2010 02:29PM
1464
April 27, 2010 07:59PM
1321
April 28, 2010 12:12AM
1581
April 28, 2010 06:22AM
1524
April 29, 2010 01:03AM
1379
April 29, 2010 02:17AM
1384
April 29, 2010 08:19AM
1387
April 29, 2010 09:18AM
1315
April 30, 2010 12:30AM
1570
April 30, 2010 07:47AM
1487
April 30, 2010 08:21AM
Re: speed up query
1399
April 30, 2010 10:08AM
1321
May 01, 2010 02:34AM
1337
May 01, 2010 09:54AM
1289
May 01, 2010 10:48AM
1418
May 01, 2010 02:20PM
1357
May 02, 2010 03:54AM


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.