国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

MySQL 查詢緩存的實際應用代碼示例

2024-07-24 12:40:37
字體:
來源:轉載
供稿:網友
以下的文章主要介紹的是MySQL 查詢緩存的實際應用代碼以及查看MySQL 查詢緩存的大小 ,碎片整理,清除緩存以及監視MySQL 查詢緩存性能的相關內容的描述,以下就是具體內容的描述,希望在你今后的學習中會有所幫助。   MySQL> select @@query_cache_type;   +--------------------+   | @@query_cache_type |   +--------------------+   | ON |    +--------------------+   MySQL> set query_cache_type=off;   MySQL> set query_cache_type=on;   MySQL>    MySQL> select sql_cache id, title, body from article;   MySQL> select sql_no_cache id, title, body from article;   MySQL> show variables like 'have_query_cache';   +------------------+-------+   | Variable_name | Value |   +------------------+-------+   | have_query_cache | YES |    +------------------+-------+   1 row in set (0.00 sec)     查看MySQL 查詢緩存的大小   MySQL> select @@global.query_cache_size;   +---------------------------+   | @@global.query_cache_size |   +---------------------------+   | 16777216 |    +---------------------------+   1 row in set (0.00 sec)   MySQL> select @@query_cache_size;   +--------------------+   | @@query_cache_size |   +--------------------+   | 16777216 |    +--------------------+   1 row in set (0.00 sec)    查看最大緩存結果,如果結果集大于該數,不緩存。   MySQL> select @@global.query_cache_limit;   +----------------------------+   | @@global.query_cache_limit |   +----------------------------+   | 1048576 |    +----------------------------+   1 row in set (0.00 sec)    碎片整理   MySQL> flush query cache   -> ;   Query OK, 0 rows affected (0.00 sec)    清除緩存   MySQL> reset query cache   -> ;   Query OK, 0 rows affected (0.00 sec   監視MySQL 查詢緩存性能:   MySQL> flush tables;   Query OK, 0 rows affected (0.04 sec)   MySQL> show status like 'qcache%';   +-------------------------+----------+   | Variable_name | Value |   +-------------------------+----------+   | Qcache_free_blocks | 1 |    | Qcache_free_memory | 16768408 |    | Qcache_hits | 6 |    | Qcache_inserts | 36 |    | Qcache_lowmem_prunes | 0 |    | Qcache_not_cached | 86 |    | Qcache_queries_in_cache | 0 |    | Qcache_total_blocks | 1 |    +-------------------------+----------+   8 rows in set (0.06 sec)     看看當前緩存中有多少條信息:   MySQL> show status like 'qcache_q%';   +-------------------------+-------+   | Variable_name | Value |   +-------------------------+-------+   | Qcache_queries_in_cache | 0 |    +-------------------------+-------+   1 row in set (0.00 sec)   MySQL> select sql_cache id, title, body from article;   MySQL> show status like 'qcache_q%';   +-------------------------+-------+   | Variable_name | Value |   +-------------------------+-------+   | Qcache_queries_in_cache | 1 |    +-------------------------+-------+   1 row in set (0.00 sec)   MySQL> show status like 'qcache_f%';   +--------------------+----------+   | Variable_name | Value |   +--------------------+----------+   | Qcache_free_blocks | 1 |    | Qcache_free_memory | 16766728 |    +--------------------+----------+   2 rows in set (0.00 sec)     以上的相關內容就是對MySQL 查詢緩存的介紹,望你能有所收獲。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 资阳市| 达日县| 忻城县| 张家港市| 临武县| 仲巴县| 和田市| 海阳市| 出国| 都匀市| 卓资县| 临清市| 英德市| 广汉市| 汕尾市| 金山区| 敦煌市| 离岛区| 壤塘县| 行唐县| 雷州市| 阿勒泰市| 大石桥市| 尉犁县| 东乌珠穆沁旗| 甘南县| 晋江市| 怀集县| 开封县| 乐至县| 新余市| 平阴县| 齐河县| 淮滨县| 甘德县| 康平县| 白沙| 香河县| 阜阳市| 名山县| 石河子市|