Thanks Paul. But that my query doesn't violate any of these conditions. Here is more detail:
mysql> show status like "%qcache%"; +-------------------------+-----------+ | Variable_name | Value | +-------------------------+-----------+ | Qcache_queries_in_cache | 0 | | Qcache_inserts | 0 | | Qcache_hits | 0 | | Qcache_lowmem_prunes | 0 | | Qcache_not_cached | 163 | | Qcache_free_memory | 511982024 | | Qcache_free_blocks | 1 | | Qcache_total_blocks | 1 | +-------------------------+-----------+ 8 rows in set (0.00 sec) mysql> show variables like "%cache%"; +--------------------------+----------------------+ | Variable_name | Value | +--------------------------+----------------------+ | bdb_cache_size | 8388600 | | binlog_cache_size | 32768 | | have_query_cache | YES | | key_cache_block_size | 1024 | | key_cache_division_limit | 100 | | key_cache_age_threshold | 300 | | max_binlog_cache_size | 18446744073709551615 | | query_cache_limit | 134217728 | | query_cache_min_res_unit | 1024 | | query_cache_size | 512000000 | | query_cache_type | ON | | table_cache | 256 | | thread_cache_size | 16 | +--------------------------+----------------------+ 13 rows in set (0.00 sec) Now issue the query: mysql> select SQL_CACHE UPC from PIMuzeIndex where UPC = "08616218713"; +-------------+ | UPC | +-------------+ | 08616218713 | | 08616218713 | | 08616218713 | | 08616218713 | | 08616218713 | | 08616218713 | | 08616218713 | +-------------+ 7 rows in set (0.00 sec) Now check the qcache status, we can see no query is cached: mysql> show status like "%qcache%"; +-------------------------+-----------+ | Variable_name | Value | +-------------------------+-----------+ | Qcache_queries_in_cache | 0 | | Qcache_inserts | 0 | | Qcache_hits | 0 | | Qcache_lowmem_prunes | 0 | | Qcache_not_cached | 164 | | Qcache_free_memory | 511982024 | | Qcache_free_blocks | 1 | | Qcache_total_blocks | 1 | +-------------------------+-----------+ 8 rows in set (0.01 sec) Any idea? Please help. Thanks HT --- Paul DuBois <[EMAIL PROTECTED]> wrote: > At 17:02 -0700 5/3/04, Haitao Jiang wrote: > >I have a complex query which took 4 seconds, I set > the > >query cache size to 512MB. BUt the query is not > >cached, it only returns 7 rows, so the cache size > is > >not a problem here. Anyway I can find out why MySQL > >4.1 is not caching my queries? > > The criteria for caching are given on this page: > > http://dev.mysql.com/doc/mysql/en/Query_Cache_How.html > > -- > Paul DuBois, MySQL Documentation Team > Madison, Wisconsin, USA > MySQL AB, www.mysql.com __________________________________ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]