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 > Database Server Software > MySQL > Optimizing MySQL for speed

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-25-06, 08:18
Edmunds Edmunds is offline
Registered User
 
Join Date: Sep 2006
Posts: 1
Optimizing MySQL for speed

Hi, I'm running 4.1.19 on Windows.

I have a single table with quite a lot of columns, and 15,500 rows. I'm running the following query:

Code:
SELECT SQL_CALC_FOUND_ROWS 
    adid, 
    1 * IF( currency =1, price, IF( currency =2, price * 0.6959, 0 ) ) AS price, 
    ad.template_cache_2 AS template_cache
FROM tp_ad AS ad
WHERE 
    ad.status =1
    AND action_type =0
ORDER BY `timestamp` DESC
LIMIT 0 , 10
The data being returned -
adid - INT
price - INT (needed in case price is in a HAVING clause if the user specifies a price)
template_cache - a template in which the ad is placed, LONGTEXT, about 2000 characters.

Indexes on status and action_type.

This query takes on average 0.25 - 0.30 seconds. I would really like to reduce that to a much smaller number, at least 3 times, I feel like 0.3 secs for some query is too much, but I honestly don't know where to start. Any help?
Reply With Quote
  #2 (permalink)  
Old 09-28-06, 10:36
Ida Hoe Ida Hoe is offline
Registered User
 
Join Date: Aug 2003
Location: West
Posts: 98
Try adding an index on `timestamp`
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