Benchmarking Views with mysql query cache on by default

Events happening in the community are now at Drupal community events on www.drupal.org.
carn1x's picture

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

mikeytown2's picture

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);
?>

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week