Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2006
    Posts
    1

    Unanswered: 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?

  2. #2
    Join Date
    Aug 2003
    Location
    West
    Posts
    101
    Try adding an index on `timestamp`

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •