Posted by carn1x on August 23, 2011 at 8:19am
I'm trying to benchmark a View on a MySQL server shared by a number of other developers, so I don't have the luxury of turning off query_cache_type since as far as I can tell, it's server wide and not restricted to per database.
I believe there's a way to turn it off per session, is there either a good way or otherwise, that I can set my particular development branch to operate with query_cache_type off.
Alternatively, a way to push SQL_NO_CACHE into Views either globally or per View would be fine.
Thanks for any advice :)
Comments
How I did it
From the dbtuner module
<?php
// Disable Query Cache for this session
$query_cache = db_fetch_array(db_query("SHOW VARIABLES WHERE Variable_name = '%s'", 'query_cache_type'));
$query_cache = $query_cache['Value'];
db_query("SET SESSION query_cache_type = OFF");
// Set query cache back to orginal state
db_query("SET SESSION query_cache_type = %s", $query_cache);
?>