views:

14

answers:

1

I'm trying to turn off mysql query cache on my local mac dev machine.

I've tried via the CL:

SELECT sql_no_cache;
RESET query cache;
SET SESSION query_cache_type = OFF;

and also in the config:

query-cache-type = 0

I installed it via macports. There are about 10 my.cnf files so maybe I'm not even editing the correct on?

/private/etc/my.cnf
/Users/dj/Downloads/mysql-5.1.41-osx10.5-x86_64/mysql-test/suite/federated/my.cnf
/Users/dj/Downloads/mysql-5.1.41-osx10.5-x86_64/mysql-test/suite/ndb/my.cnf
/Users/dj/Downloads/mysql-5.1.41-osx10.5-x86_64/mysql-test/suite/rpl/my.cnf

etc ...

I would think the command line stuff should work though.

I think I've tried everything I've found online to no avail. Really appreciate any help. Thanks!

A: 

sql_no_cache usage is to add it ater every select statement (query) you do.

Such as:

select  sql_no_cache * from mytable;

You can be sure this would not be cached. However there are a lot of other caches involved in the process of retrieving data from tables, from the harddrives and/or controllers themselves to the operating system caching frequent used files, to the storage engines mysql uses (such as innodb's buffer).

Why do you want your queries not to be cached?

If it's for benchmarking, I'd suggest restart mysql server before each execution.

my.cnf should be located at /etc/my.cnf.

ceteras
I've tried select sql_no_cache * from mytable and it is definitely still caching. I need to turn it off for development purposes. I'm trying to optimize the queries and this is impossible is they are cached. Restarting the mysql server before each execution is prohibitive when trying to iterate with my development.
bandhunt
Have you tried `SET GLOBAL query_cache_size = 0;` ?Also, you can modify my.cnf and set all kind of buffers to small values (innodb_buffer_pool_size for innodb, key_buffer_size for myisam).Actually I've googled it myself and I believe this will help you: http://www.mysqlperformanceblog.com/2007/09/12/query-profiling-with-mysql-bypassing-caches/
ceteras