When using MySQLdb on debian (MySQL 4.0.24;
MySQLdb 1.2) the MySQL-Query-caceh isn't used.
Using _mysql directly it works.
Logged In: YES
You've provided no evidence to support this position.
Logged In: NO
I just experience exactly the same thing. I am also on
Debian, MySql version 4.0.24_Debian-10sarge1-log. And using
MySQLdb.version_info = (1, 2, 1, 'gamma', 2).
I am actually using MySQLdb via a Python web framework
called Django (www.djangoproject.com). And a lot queries
seem to get cached, because the number
Qcache_queries_in_cache is increasing. But, the number of
cache hits stays zero! However when I execute a query
several times on the MySQL command line the number of cache
hits actually do increase.
If you can write a test case that demonstrates this, I'll
try to fix it in 1.3. Your test case should print the result of:
But I think this is your problem:
"In MySQL 4.0, the query cache is disabled within
transactions (it does not return results). Beginning with
MySQL 4.1.1, the query cache also works within transactions
when using InnoDB tables (it uses the table version number
to detect whether its contents are still current)."
So your problem would appear to be due to using 4.0.x. I'd
recommend trying with 4.1 or 5.0. I am still pretty certain
this is not a MySQLdb issue.
So I did a test and installed
mysql-standard-5.0.20-linux-x86_64-glibc23. Created a
completely new database and restored a dump from my 'old'
database. Then I had to adjust the query_cache_size.
Now when I browse my website the number of Qcache_hits does
So, it appears that using MySQL 5.0 does solve my issue.
Thanks very much for your help. Here and on the Django Users
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.