Sergei Golubchik wrote:
> Hi, Kristofer!
>
> On Oct 08, Kristofer Pettersson wrote:
>> #At file:///home/thek/Development/cpp/mysqlbzr/mysql-5.0-bug37416/
>>
>> 2693 Kristofer Pettersson 2008-10-08
>> Bug#37416 When SQL_NO_CACHE is used, MySQL still lookup into the
>> query cache
>>
>> The query cache module did not check for the SQL_NO_CACHE
>> keyword before attempting to query the hash lookup table. This
>> had a small performance impact.
>>
>> By introducing a check on the query string before obtaining the
>> hash mutex we can gain some performance if the SQL_NO_CACHE
>> directive is used often.
>
> Check SQL_NO_CACHE completely - all letters.
> And do it only in the "on demand" mode, as jocelin suggests.
According to the documentation (and the code):
"...DEMAND causes caching of only those statements that begin with
SELECT SQL_CACHE."
It seems redundant to check for SQL_NO_CACHE since it would be
reasonable to expect a DBA _not_ to add this directive if he already
explicitly introduced the policy that no queries are cached per default.
Right?
>
> And I'd rather have the check inline, not in a separate function, but
> it's up to you to decide.
How about the compromise "online bool has_no_cache_directive(...) { .. } ?
Cheers,
Kristofer