Actually there's a bug opened to avoid a query with SQL_NO_CACHE keyword
looking into the QC :
http://bugs.mysql.com/bug.php?id=37416
Regards,
Jocelyn Fournier
Le 18/02/2009 18:22, Rick James a écrit :
> It is possible that someone, today, is changing a comment in order to
> bypass the QC. This would be an incompatible change for them. However,
> the benefit might outweigh the drawback.
>
> It would be nice if your change could cut back on the frequency or time
> taken to lock the QC; this is becoming a non-trivial performance issue
> in these days of 8-core SMP machines.
>
>
> Rick James
> MySQL Geeks - Consulting& Review
>
>
>
>> -----Original Message-----
>> From: Michael Widenius [mailto:monty@stripped]
>> Sent: Wednesday, February 18, 2009 5:39 AM
>> To: Eric
>> Cc: internals@stripped
>> Subject: re: comments and query cache
>>
>>
>> Hi!
>>
>>>>>>> "Eric" == Eric<esquid2@stripped> writes:
>> Eric> Hi All-
>> Eric> AFAICT, query comments are used as part of the hash key
>> for query cache (at
>> Eric> least in 5.0). Is this intentional? Still the case in
>> newer versions of
>> Eric> mysql?
>>
>> Yes; It's mainly for speed but also because comments can affect the
>> way queries are executed (if you use optimizer hints)
>>
>> <cut>
>>
>> Eric> I have a patch (attached) to strip comments before
>> checking and storing the
>> Eric> query into the query cache but wanted to see if this
>> was a reasonable way to
>> Eric> do it. Also, I couldn't find a very reasonable
>> function to strip comments.
>> Eric> (The one in innobase/hash/hash0hash.c seemed the best,
>> but I imagine it is
>> Eric> not fit to include so I copied it just to get my
>> proof-of-concept working
>> Eric> until/if something better is decided.)
>>
>> Don't know of any other function to do that.
>>
>> Eric> If this seems useful and reasonable, is there a better
>> way to get the
>> Eric> comments stripped? Should I implement my own? (Should
>> be able to be done
>> Eric> in the existing char* without allocating any new memory, right?)
>>
>> If you *only* strip safe comments (not using the /*!...*/ syntax you
>> can strip it in the original memory.
>>
>> Eric> Does
>> Eric> InnoDB (what we use) or any other engine depend on the
>> comments in any way
>> Eric> (I know oracle puts query hints in there)? How should
>> this behavior be
>> Eric> enabled since I imagine not everyone will want the
>> runtime v. cache hit
>> Eric> tradeoff. ./configure option? my.cnf? a dynamic variable?
>>
>> You should have this either as a dynamic variable or a connection
>> option. This is to not cause an extra parsing overhead in the case
>> where comments are static for the query.
>>
>> Regards,
>> Monty
>>
>> --
>> MySQL Internals Mailing List
>> For list archives: http://lists.mysql.com/internals
>> To unsubscribe:
>> http://lists.mysql.com/internals?unsub=1
>>
>>
>