Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

MySQL Query Cache

A Practical Look at the MySQL Query Cache
http://dev.mysql.com/tech-resources/articles/mysql-query-cache.html
Êý¾Ý¿â»º´æ²ßÂÔ£º
£¨1£©»º´æ¾­³£±»Ê¹ÓõÄÊý¾Ý
£¨2£©»º´æ¾­³£Ö´ÐеÄSQLºÍ´æ´¢¹ý³Ì´úÂë
£¨3£©»º´æÊý¾Ý¿âÔªÊý¾ÝÐÅÏ¢£¬°üÀ¨£º¶ÔÏó½á¹¹»º´æ¡¢°²È«ÐÅÏ¢µÈ
mysqlÒýÇæËùʹÓõĻº´æ£º
£¨1£©myisam:key buffer
£¨2£©innodb:data + index buffer
£¨3£©memory:data + index buffer
²»ÊÇCache Hit RatioÔ½¸ßÔ½ºÃ£¬¼ÙÈ磺
AºÍBÊDz»Í¬µÄSQLÓï¾ä£¬Óв»Í¬µÄÖ´Ðмƻ®£¬µ«·µ»ØÏàͬµÄ½á¹û¼¯£¬²¢ÇÒAµÄÊý¾Ý¿âµÄ»º´æ½Ï´ó
SQL
Cache Hit Ratio
Logical I/O
Physical I/O
Time
A
99.99%
10000
1
0.405secs
B
90.00%
10
1
0.005secs
ÒòΪÂß¼­I/O»á¶ÔÄÚ´æ½øÐÐËø²Ù×÷À´´ÓÄڴ潨Á¢½á¹û¼¯£¬Õâ»áÔì³ÉÐí¶àCPU»î¶¯¡£
Ïà¹ØµÄ²ÎÊý£º
£¨1£©query_cache_type    ON|DEMAND|OFF
ONʱ£¬²»»º´æÓÐSQL_NO_CACHEµÄSELECT
DEMANDʱ£¬Ö»»º´æSQL_CACHEµÄSELECT
£¨2£©query_cache_size    ²éѯ»º´æµÄ´óС£»0ʱ£¬Êǹرղéѯ»º´æ
£¨3£©query_cache_limit    ָʾÿ¸ö²éѯ½á¹û¼¯×î´óµÄ»º´æÏÞÖÆ£¬³¬¹ýÕâ¸öÖµµÄ½á¹û¼¯²»»º´æ
£¨4£©query_alloc_block_size   »º´æ·ÖÅäµÄ¿é´óС
£¨5£©query_cache_min_res_unit    ±»·ÖÅä¸ø»º´æµÄ×îСµÄ¿éµÄÊýÁ¿
£¨6£©query_cache_wlock_invalidate   ±»Ð´ËøÎÞЧ»¯µÄ²éѯ»º´æµÄÊýÁ¿
£¨7£©query_prealloc_size   ±»»º´æÓÃÓÚ½âÎöºÍÖ´Ðеij־ÃbufferµÄ´óС
Ïà¹ØµÄ״̬£º
£¨1£©Qcache_inserts£ºÊý¾Ý·ÅÈ뻺´æµÄ´ÎÊý
£¨2£©Qcache_hits£º»º´æÃüÖеĴÎÊý
£¨3£©Qcache_free_blocks£º»º´æÖÐ×ÔÓɵĿéÊý£»Èç¹û´ËÖµºÜ¸ß£¬ÔòָʾÁËÄÚ´æÖÐÓÐÐí¶àËéƬ£¬¿ÉÒÔÓÃflush query cacheÀ´½â¾öÕâ¸öÎÊÌâ
£¨4£©Qcache_free_memory£º×ÔÓÉ»º´æµÄ´óС
£¨5£©Qcache_lowmem_prunes£ºÖ¸Ê¾ÓжàÉÙ´Îmysql±ØÐë´Ó²éѯ»º´æÖÐÒƳýÌõÄ¿£¬´Ó¶øΪÁËнøÒ»´ÎµÄ²éѯ
£¨6£©Qcache_not_cached£º²»Äܹ»»º´æµÄSQL½á¹û¼¯µÄÊýÁ¿
²éѯµÄÏÞÖÆ£º
£¨1£©ÏàͬµÄ²éѯ¿ÉÒÔ±»»º´æ·þÎñ
£¨2£©ÈκÎDMLÓï¾ä£¬Äܹ»Ê¹Ïà¹ØÓÚÕâ¸ö±íµÄ²éѯ»º´æÎÞЧ
£¨3£©¶à¸öº¯Êý£¬È磺CURRENT_DATE£¬NOW£¬RANDÓÃÓÚ²éѯÖУ¬Ôò²»±»»º´æ
£¨4£©Ê¹ÓÃÓû§¶¨ÒåµÄº¯ÊýµÄ²éѯ²»Äܱ»»º´æ
Ïà¹ØµÄÃüÁ
set global
set session
show variables like 'query%'
show status l


Ïà¹ØÎĵµ£º

linux yum°²×°mysqlºóҪעÒâµÄһЩ³õʼ»¯ÎÊÌâ

zz linux yum°²×°mysqlºóҪעÒâµÄһЩ³õʼ»¯ÎÊÌâ
ÎҵķþÎñÆ÷×°µÄÊÇcentos 5.3,ÓÉÓÚ×ʼ°²×°×öÁËÏêϸµÄ¼Ç¼,ËùÒÔÕû¸ö¹ý³ÌÒ²ÊÇÇá³µÊì·,һ·yumÏÂÀ´£¬¾Í¸ã¶¨ÁË£¬È»ºó¾ÍÊÇÊý¾Ý¿â¡¢ÍøÕ¾µÄ°á¼Ò£¬ÇáËɸ㶨~
¿ÉÊǽñÌìÔÚ¼Ò¿´ÁËϹ«Ë¾µÄÍøÕ¾£¬ÎÊÌâ³öÀ´ÁË~ ÓÐЩ²úÆ·µã»÷²é¿´ÏêϸÐÅÏ¢µÄʱºò£¬ÕÒ²»µ½ÍøÒ³~¾­¹ýÒ»·¬Ë¼¿¼£¬·¢ÏÖÊÇmysql ......

Óà PHP µ÷Óà MySQL ´æ´¢¹ý³Ì

    MySQL 5.0 ÒÔÉÏÖ§³Ö´æ´¢¹ý³Ì¡£
    PHP 5.0 ÒÔÉ쵀 mysqli ϵÁк¯Êý¿ÉÒÔÖ§³Ö²Ù×÷ MySQL µÄ´æ´¢¹ý³Ì¡£
    ÒÔÏÂÊÇһЩ¼òµ¥µÄ´æ´¢¹ý³ÌºÍÓà PHP µ÷ÓõÄʾÀý¡£     Ò»¡¢·µ»Øµ¥¸öÊý¾Ý: 1: <?php
2: header("Content-Type:t ......

CentOS+Apache+Mysql+Php°²×°¼°ÓÅ»¯ÅäÖÃС¼Ç


±¾ÎÄÈí¼þµÄÏÂÔصØÖ·¾Í²»Áгö£¬Ö÷ÒªÊǼǼ°²×°Ê±µÄ²½Öè¼°Ïà¹ØÎÊÌâµÄ´¦Àí·½·¨£»»ùÓÚ°²×°·½·¨Ä¿Ç°ÓÐÁ½ÖÖ£¬Ò»ÖÖÊÇÀûÓÃRPM°ü°²×°£¬Ò»ÖÖÔ´Âë±àÒë°²×°£»ÒÔÏÂÖ÷
ÒªÊÇÒÔÔ´Âë±àÒë°²×°£»ÒòΪԴÂë°²×°Èí¼þµÄÏ໥ÒÀÀµÐÔС£¬°²×°·½Ê½Óø÷ÖÖunix/linuxϵͳ£¬Î¬»¤·½±ã¡£Èç¹ûÏëÈ¥³ýÏà¹Ø·þÎñʱ£¬Ö±½Órm
–rfĿ¼ ¼´¿É£»½¨Òé²ÉÓÃÔ´Âë· ......

Ò»ÖÖ²»´íµÄ´ÓSQLתMysqlÊý¾Ý¿âµÄ·½·¨

Äê³õµÄʱºòÒ»Ö±ÔÚ×öÒ»¸öÍøÕ¾MSSQL2000->MySQL5µÄǨÒƹ¤×÷£¬ÒòΪ²ÉÓÃÁ˲»Í¬µÄ³ÌÐòϵͳ£¬ËùÒÔÖ÷ÒªÎÊÌâÔÚÊý¾ÝµÄǨÒÆ¡£ÓÉÓÚ2¸öϵͳÊý¾Ý¿â½á¹¹²îÒì·Ç³£´ó£¬²»·½±ã²ÉÈ¡SQLSERVERÀïµ¼ÈëMYSQLµÄODBCÊý¾ÝÔ´µÄ¹¦ÄÜ£¨Ò²²»ÍƼöÕâô×ö£¬×Ö¶ÎÀàÐ͵Ȳ»Í¬µã»á¸ãËÀÈ˵ġ«£©£¬Òò´Ë¾ÍÔÚWINDOWSÏÂ×Ô¼ºÐ´PHP½Å±¾´ÓSQLSERVERÀï¶ÁÊý¾Ý£¬È»ºó°´ÕÕ ......

mysqlÖеÄSQL·ÖÎö¹¤¾ß

Another Look at MySQL 5.1's SQL Diagnostic Tools
http://dev.mysql.com/tech-resources/articles/mysql_51_diagnostic_tools.html Êý¾Ý¿âµÄÐÔÄܾö¶¨ÒòËØ£º
£¨1£©Êý¾Ý¿âµÄÉè¼Æ
£¨2£©SQL´úÂë ¿ÉÒÔÓÃÒÔϼ¸ÖÖ·½·¨À´½â¾öһЩÐÔÄÜÎÊÌ⣺
£¨1£©Ë÷Òý
£¨2£©Ë®Æ½·ÖÇø
£¨3£©ÁÐÊÊÓ¦µÄ±í
colum ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ