mysql cache¹¦ÄÜС¼Ç
http://www.cnblogs.com/rethink/archive/2009/10/09/1579634.html
mysql cache¹¦ÄÜ·ÖÎö£º
1
mysqlµÄcache¹¦ÄܵÄkeyµÄÉú³ÉÔÀíÊÇ£º°ÑselectÓï¾ä°´ÕÕÒ»¶¨µÄhash¹æÔòÉú³ÉΨһµÄkey£¬selectµÄ½á¹ûÉú³Évalue£¬¼´key=>value¡£ËùÒÔ¶ÔÓÚcache¶øÑÔ£¬selectÓï¾äÊÇÇø·Ö´óСдµÄ£¬Ò²Çø·Ö¿Õ¸ñµÄ¡£Á½¸öselectÓï¾ä±ØÐëÍêÍêÈ«È«Ò»Ö£¬²ÅÄܹ»»ñÈ¡µ½Í¬Ò»¸öcache¡£
2
Éú³ÉcacheÖ®ºó£¬Ö»Òª¸ÃselectÖÐÉæ¼°µ½µÄtableÓÐÈκεÄÊý¾Ý±ä¶¯£¨insert£¬update£¬delete²Ù×÷µÈ£©,Ïà¹ØµÄËùÓÐcache¶¼»á±»É¾³ý¡£
Òò´ËÖ»ÓÐÊý¾ÝºÜÉٱ䶯µÄtable£¬ÒýÈëmysql µÄcache²Å½ÏÓÐÒâÒå¡£¹ØÓÚÕâ·½ÃæµÄ²âÊÔ£¬¿ÉÒԲο¼£º¡¶Query Cache£¬¿´ÉÏÈ¥ºÜÃÀ¡·
Ò»ÎÄ¡£
ËùÒÔ£¬mysqlµÄcache¹¦ÄÜÖ»ÊÊÓÃÓÚÏÂÁг¡ºÏ£ºÊý¾Ý±ä¶¯½ÏÉÙ£¬select½Ï¶àµÄtable¡£
ÄÇô¡£ÔÚ¸´ÔÓµÄϵͳÖУ¬ÈçºÎʹÓÃmysqlµÄcache¹¦ÄÜÄØ£¬»ù±¾·½·¨ÈçÏ£º
ÅäÖÃquery_cache_type£¬Í¬Ê±¸Äд³ÌÐò¡£
query_cache_type 0 ´ú±í²»Ê¹Óûº³å£¬ 1 ´ú±íʹÓûº³å£¬2 ´ú±í¸ù¾ÝÐèҪʹÓá£
ÉèÖà 1 ´ú±í»º³åÓÀÔ¶ÓÐЧ£¬Èç¹û²»ÐèÒª»º³å£¬¾ÍÐèҪʹÓÃÈçÏÂÓï¾ä£º
SELECT SQL_NO_CACHE * from my_table WHERE ...
Èç¹ûÉèÖÃΪ 2 £¬ÐèÒª¿ªÆô»º³å£¬¿ÉÒÔÓÃÈçÏÂÓï¾ä£º
SELECT SQL_CACHE * from my_table WHERE ...
So£¬×î¼òµ¥ÓÖ¿É¿¿µÄ×ö·¨ÊÇ£º°Ñquery_cache_typeÉèÖÃΪ2£¬È»ºóÔÚÐèÒªÌá¸ßselectËٶȵĵط½£¬Ê¹Óãº
SELECT SQL_CACHE * from...
µÄ·½Ê½½øÐÐSELECT¡£
¡¾mysql cacheµ÷ÊԱʼǡ¿
1
¿ÉÒÔʹÓÃÏÂÁÐÃüÁÆômysqlµÄselect cache¹¦ÄÜ£º
SET GLOBAL query_cache_size = 102400000;
ÒòΪµ±query_cache_sizeĬÈÏΪ0ʱ£¬ÊDz»¿ªÆôcache¹¦Äܵġ£
2
µ÷ÊÔ£º
²é¿´cacheµÄÉèÖãº
show variables like '%query_cache%';
ÐÔÄܼà¿Ø£º
show status like '%Qcache%';
3
mysql cacheµÄÇåÀí£º
¿ÉÒÔʹÓÃFLUSH QUERY CACHEÓï¾äÀ´ÇåÀí²éѯ»º´æËéƬÒÔÌá¸ßÄÚ´æʹÓÃÐÔÄÜ¡£¸ÃÓï¾ä²»´Ó»º´æÖÐÒƳöÈκβéѯ¡£
RESET QUERY CACHEÓï¾ä´Ó²éѯ»º´æÖÐÒƳöËùÓвéѯ¡£FLUSH TABLESÓï¾äÒ²Ö´ÐÐͬÑùµÄ¹¤×÷¡£
Ïà¹ØÎĵµ£º
ÔÚVC6ÖÐʹÓÃc API·½Ê½Á¬½ÓMySQLÊý¾Ý¿â
Ò»¡¢»·¾³ÅäÖÃ
1¡¢ÔÚMySqlµÄ¹Ù·½ÍøÕ¾ÏÂÔØmysql-connector-c-noinstall£¬²¢½«½âѹºóµÄbinºÍincludeÎļþ¼Ð¿½±´µ½MysqlµÄ°²×°Ä¿Â¼
2¡¢ÉèÖÃVC6»·¾³£¬ÔÚvc¹¤¾ß-Ñ¡Ïî-Ŀ¼£¬¼ÓÈë¸Õ²ÅµÄIncludeÎļþ¼ÐµÄ·¾¶£¬ÀýÈ磺C:\Program Files\MySQL\MySQL Server 5.1\include
¶þ¡¢¹¤³ÌÉèÖÃ
3¡¢½«li ......
Mysql Explain Ïê½â
Ò».Óï·¨
explain < table_name >
ÀýÈç: explain select * from t3 where id=3952602;
¶þ.explainÊä³ö½âÊÍ
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
| id | select_type | table | type | possible_keys &nb ......
¡ñjspÁ¬½ÓMySQLÊý¾Ý¿â
testmysql.jspÈçÏ£º
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/softforum?
user=soft&pas ......
±¾ÎÄתÔØ×Ô£ºhttp://www.54xue.com/?action-viewnews-itemid-7498
#BEGIN CONFIG INFO
#DESCR: 4GB RAM, ֻʹÓÃInnoDB, ACID, ÉÙÁ¿µÄÁ¬½Ó, ¶ÓÁиºÔØ´ó
#TYPE: SYSTEM
#END CONFIG INFO
#
# ´ËmysqlÅäÖÃÎļþÀý×ÓÕë¶Ô4GÄÚ´æ
# Ö÷ҪʹÓÃINNODB
#´¦Àí¸´ÔÓ¶ÓÁв¢ÇÒÁ¬½ÓÊýÁ¿½ÏÉÙµÄmysql·þÎñÆ÷
#
# ½«´ËÎļþ¸´ÖƵ½/etc/m ......
ÐÞ¸ÄrootÃÜÂëµÄʱºò°´ÕÕÍøÉϵÄ˵µÄ¾ÓȻɵɵµÄÖ´ÐÐÁËupdate user set password="asdf" where user="root"£»Ö´ÐÐÖ®ºó·¢ÏÖÃÜÂë´íÁË£¬½øÈ¥²»ÁË£¬ÓÚÊÇÕÛÌÚÁË°ëÌ죬·¢ÏÖmysqlµÄÃÜÂëÊǼÓÃܵIJ»ÊÇÃ÷ÎÄ´æ´¢µÄ£¬ËùÒԸĵÄʱºòÐèÒªÕâÑùset password=password("asdf")¡£´íÎóÒѾ·¢ÉúÁË£¬ÓÚÊǾͰ´ÕÕÏÂÃæµÄ· ......