Hi, Kristofer!
On Oct 10, Kristofer Pettersson wrote:
> 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."
Ah, right. Silly me.
Sorry.
> 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(...) { .. } ?
As I wrote - up to you. I'm fine with a function or without. Just make
the function static, if you do a function.
gcc is pretty good at inlining, you rarely need to specify inline
explicitly. You need to specify "static" though (with inline or without,
doesn't matter) so that gcc wouldn't emit the code for a function at
all.
Regards / Mit vielen Grüßen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring