If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > MySQL DB Optimization

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-01-04, 00:09
rageous rageous is offline
Registered User
 
Join Date: Apr 2004
Posts: 9
MySQL DB Optimization

I have the below query that takes about 5 seconds to execute on MySQL 4.0.18 with Windows 2000 with 512 MB RAM.

select HIGH_PRIORITY INET_NTOA(Table1.IP_COLUMN1) as COLA, INET_NTOA(Table1.IP_COLUMN2) as COLB, Table2.COLUMN1 as COLC, Table2.COLUMN2 as COLD, Table2.COLUMN3 as COLE, sum(Table1.COLUMN3) as n, Table2.COLUMN4 as COLF from Table1, Table2 where Table1.COLUMN5 = Table2.COLUMN5 and Table1.COLUMN5 = '37' and TIME between 20041130101200 and 20041201101200 group by COLA, COLB, COLC, COLD, COLE order by n desc LIMIT 100

Table1 (a MyISAM table) has about 1 million records and Table2 (InnoDB) has about 1500 records. Table1.COLUMN5='37' is satisfied by about 10000 rows. Table1 gets about 30000 records once every 3 minutes and this is loaded from a file using a "load data infile....". I have been able to reduce this "load data infile..." to about 2 seconds but my select queries (which is what I want to be really fast) have actually become slower after I changed the start up parameters as below:

I have started MySQL with the below options:

--read_buffer_size=8000000 --read_rnd_buffer_size=12000000 --sort_buffer_size=8400000 --myisam_sort_buffer_size=64000000 --key_buffer_size=128000000 --bulk_insert_buffer_size=16000000 --table_cache=256 --low-priority-updates

My key_reads to key_read_requests ratio is a healthy 1:700

Do I have the read_buffer_size and read_rnd_buffer_size right??? Any other suggestions?????
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On