MySQL Forums
Forum List  »  Newbie

Re: Another newbie question
Posted by: Peter Brawley
Date: February 11, 2014 10:41AM

To optimise, first turn off query caching so repeat benchmarks can be meaningful. We use an sproc for that ...

Create Procedure setquerycaching( pcache bool )
BEGIN
  IF NOT pcache THEN
    IF @prev_query_cache_type IS NOT NULL THEN
      SET @prev_query_cache_type = @@LOCAL.query_cache_type;
    END IF;
    IF @prev_query_cache_size IS NULL THEN
      SET @prev_query_cache_size = @@GLOBAL.query_cache_size;
    END IF;
    SET LOCAL query_cache_type = 0;
    SET GLOBAL query_cache_size = 0;
    RESET QUERY CACHE;
  ELSE
    IF @prev_query_cache_type IS NOT NULL THEN
      SET LOCAL query_cache_type= @prev_query_cache_type;
    END IF;
    IF @prev_query_cache_size IS NOT NULL THEN
      SET GLOBAL query_cache_size= @prev_query_cache_size;
    END IF;
  END IF;
  SELECT
    pcache AS 'Query Caching',
    @@LOCAL.query_cache_type AS QCacheType, @prev_query_cache_type AS 'PrevType',
    @@GLOBAL.query_cache_size AS QCacheSize,@prev_query_cache_size AS 'PrevSize'
;
END

Then get a baseline benchmark, then run EXPLAIN EXTENDED on the query---that will tell you which elements need indexing help. Post the result here if the result puzzles you.

To see how a WHERE clause affects performance, comment it out and benchmark again.

AFAIK MySQL does not optimise Find_In_Set(), so it commits the engine to reading 60K rows, so it may be an argument for designing an intermediate (denormalised) result table with that result built in.

Options: ReplyQuote


Subject
Written By
Posted
February 06, 2014 11:58PM
February 07, 2014 01:11AM
February 07, 2014 06:41AM
February 07, 2014 11:15AM
February 07, 2014 07:50PM
February 08, 2014 11:54AM
February 08, 2014 05:41PM
February 08, 2014 06:55PM
February 08, 2014 06:59PM
February 08, 2014 08:48PM
February 09, 2014 02:56AM
February 09, 2014 07:43PM
February 10, 2014 02:31PM
February 11, 2014 05:10AM
Re: Another newbie question
February 11, 2014 10:41AM
February 11, 2014 08:12PM
February 12, 2014 12:50AM
February 12, 2014 08:32AM
February 12, 2014 07:39PM
February 12, 2014 10:47PM
February 12, 2014 11:50PM
February 13, 2014 12:00AM
February 13, 2014 02:14AM
February 13, 2014 11:10PM
February 16, 2014 12:51AM
February 27, 2014 04:54AM
February 27, 2014 08:47PM


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.