¿ªÆô MySQL query cache£¬¼Ó¿ìÊý¾Ý¿â¶ÁÈ¡ËÙ¶È
ÔÚÍøÕ¾½¨Éè»òÕßÔËÓªÖУ¬Èç¹û MySQL server ÊǷdz£·±Ã¦£¬¿ÉÒÔ¿ªÆô query cache ÒÔ¼ÓËÙ»ØӦʱ¼ä£¬¿ªÆô·½·¨¿ÉÒÔÔÚ my.cnf 裡Ãæ¼ÓÈëÒÔÏÂÏîÄ¿: (Redhat ÏÂÃæÊÇ /etc/my.cnf£»Debian ÊÇÔÚ etc/mysql
/my.cnf).
query_cache_size = 64M
query_cache_type = 1
query_cache_limit = 1048576
ÒÔÉÏÓï·¨µÄÉ趨ÀïÃ棬query_cache_size ÊÇ·ÖÅä 256MB ¼ÇÒäÌå¿Õ¼ä¸ø query
cache£»query_cache_type É趨³É 1£¬ÊǸøËùÓеIJéѯ×ö cache£»query_cache_limit
ÊÇÖ¸¶¨¸ö±ðµÄ²éѯÓï¾ä 1KB µÄ¼ÇÒäÌå¿Õ¼ä¡£
ÕâЩÊýÖµ¿É¸ù¾Ý×Ô¼ºµÄÐèÒª×÷³ö¸ü¸Ä£¬É趨¼°´æµµºó£¬ÖØÐÂÆô¶¯ MySQL ¼´¿É¡£
Query Cache ÔÚÌá¸ßÊý¾Ý¿âÐÔÄÜ·½Ãæ¾ßÓзdz£ÖØÒªµÄ×÷Óá£
ÆäÉ趨Ҳ·Ç³£¼òµ¥£¬½öÐèÒªÔÚÅäÖÃÎļþдÈëÁ½ÐУº query_cache_type ºÍ query_cache _size£¬¶øÇÒ MySQL µÄ query cache ·Ç³£¿ì£¡¶øÇÒÒ»µ©ÃüÖУ¬¾ÍÖ±½Ó·¢Ë͸ø¿Í»§¶Ë£¬½ÚÔ¼´óÁ¿µÄ CPU ʱ¼ä¡£
µ±È»£¬·Ç SELECT Óï¾ä¶Ô»º³åÊÇÓÐÓ°ÏìµÄ£¬ËüÃÇ¿ÉÄÜʹ»º³åÖеÄÊý¾Ý¹ýÆÚ¡£Ò»¸ö UPDATE
Óï¾äÒýÆðµÄ²¿·Ö±íÐ޸ģ¬½«µ¼Ö¶ԸñíËùÓеĻº³åÊý¾ÝʧЧ£¬ÕâÊÇ MySQL ΪÁËƽºâÐÔÄܶøûÓвÉÈ¡µÄ´ëÊ©¡£ÒòΪ£¬Èç¹ûÿ´Î UPDATE
ÐèÒª¼ì²éÐ޸ĵÄÊý¾Ý£¬È»ºó³·³ö²¿·Ö»º³å½«µ¼Ö´úÂëµÄ¸´ÔÓ¶ÈÔö¼Ó¡£
query_cache_type 0 ´ú±í²»Ê¹Óûº³å£¬ 1 ´ú±íʹÓûº³å£¬2 ´ú±í¸ù¾ÝÐèҪʹÓá£
ÆäʵMySQLÖÐÓÐÄÚ´æ±íÁË, ÍêÈ«¿ÉÒÔ²»ÓÃÕâ¸ö¹¦ÄÜ. ¶ÔÓÚQuery Cache, MySQLÌṩÁËquery_cache_type±äÁ¿À´¿ØÖÆ·¢Ë͵½Êý¾Ý¿âµÄSQLÊÇ·ñ½øÐÐCache, ÓÐÈý¸öÖµ:
0, ¶ÔSQLÓï¾ä²»½øÐÐCache.
1, ¶ÔÓÚÓÐSQL_NO_CACHEÌáʾµÄSQL²»½øÐÐCache.
2, ½ö¶ÔÓÚÓÐSQL_CACHE½øʾµÄSQL½øÐÐCache.
ת×Ô£º¿ªÆô MySQL query cache£¬¼Ó¿ìÊý¾Ý¿â¶ÁÈ¡ËÙ¶È
»¹ÓÐһƪ×ÊÁÏ¿ÉÒÔ¸¨Öúѧϰ http://hi.baidu.com/xytel/blog/item/d74d4c1204e4d959f919b827.html
Ïà¹ØÎĵµ£º
1 ÉèÖÃphpMyAdmin
Language:Chinese simplified (zh-utf-8)
MySQL ×Ö·û¼¯£ºUTF-8 Unicode (utf8)
MySQL Á¬½ÓУ¶Ô gbk_chinese_ci
2 ´´½¨Êý¾Ý¿âʱ
ÕûÀíÉèÖÃ³É gbk_chinese_ci
3 ÓÃSQL½¨Á¢±íÖÐ
ENGINE=MyISAM DEFAULT CHARSET=gbk;
ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=40 ;
4 ¼ì²é±í½á¹¹ÖÐ
varcha ......
integer »òÕß int
int »òÕß java.lang.Integer
INTEGER
4 ×Ö½Ú
long
long Long
BIGINT
8 ×Ö½Ú
short
short Short
SMALLINT
2 ×Ö½Ú
byte
byte Byte
TINYINT
1 ×Ö½Ú
float
float Float
FLOAT
4 ×Ö½Ú
double
double Double
DOUBLE
8 ×Ö½Ú
b ......
1 °²×°MySQL5
ÓÃÏÂÁÐÃüÁî°²×°MySQL£º
yum install mysql mysql-server
È»ºóÎÒÃÇΪMySQL´´½¨ÏµÍ³Æô¶¯Á´½Ó£¨ÕâÑùµÄ»°£¬MySQL¾Í»áËæ×ÅϵͳÆô¶¯¶øÆô¶¯£©£¬²¢Æô¶¯MySQL·þÎñÆ÷£º
chkconfig –levels 235 mysqld on
/etc/init.d/mysqld start
ÔËÐÐ
mysqladmin -u root password yourrootsqlpassword
À´ÎªrootÓû§ÉèÖà ......
MySQLÖÐʹÓô洢¹ý³Ì
ʹÓÃCallableStatementsÖ´Ðд洢¹ý³Ì
mysql°æ±¾:5.0
Connector/JµÄ°æ±¾:3.1.1ÒÔÉÏ(java.sql.CallableStatement½Ó¿ÚÒÑÍêȫʵÏÖ,³ýÁËgetParameterMetaData()·½·¨)
MySQLµÄ´æ´¢¹ý³ÌÓï·¨ÔÚMySQL²Î¿¼ÊÖ²áµÄ"´æ´¢¹ý³ÌºÍº¯Êý"Ò»ÕÂ.
http://www.mysql.com/doc/en/Stored_Procedures.html
ÏÂÃæÊÇÒ»¸ ......