¹ØÓÚMySQLµÄ²éѯ»º´æ
ÔÀí
QueryCache(ÏÂÃæ¼ò³ÆQC)ÊǸù¾ÝSQLÓï¾äÀ´cacheµÄ¡£Ò»¸öSQL²éѯÈç¹ûÒÔselect¿ªÍ·£¬ÄÇôMySQL·þÎñÆ÷½«³¢ÊÔ¶ÔÆäʹÓÃ
QC¡£Ã¿¸öCache¶¼ÊÇÒÔSQLÎı¾×÷ΪkeyÀ´´æµÄ¡£ÔÚÓ¦ÓÃQC֮ǰ£¬SQLÎı¾²»»á±»×÷Èκδ¦Àí¡£Ò²¾ÍÊÇ˵£¬Á½¸öSQLÓï¾ä£¬Ö»ÒªÏà²îÄÄÅÂÊÇÒ»¸ö×Ö·û£¨ÀýÈç´óСд²»Ò»Ñù£»¶àÒ»¸ö¿Õ¸ñµÈ£©£¬ÄÇôÕâÁ½¸öSQL½«Ê¹Óò»Í¬µÄÒ»¸öCACHE¡£
²»¹ýSQLÎı¾ÓпÉÄܻᱻ¿Í»§¶Ë×öһЩ´¦Àí¡£ÀýÈçÔÚ¹Ù·½µÄÃüÁîÐпͻ§¶ËÀÔÚ·¢ËÍSQL¸ø·þÎñÆ÷֮ǰ£¬»á×öÈçÏ´¦Àí£º
¹ýÂËËùÓÐ×¢ÊÍ
È¥µôSQLÎı¾Ç°ºóµÄ¿Õ¸ñ,TABµÈ×Ö·û¡£×¢Ò⣬ÊÇÎı¾Ç°ÃæºÍºóÃæµÄ¡£ÖмäµÄ²»»á±»È¥µô¡£
ÏÂÃæµÄÈýÌõSQLÀÒòΪSELECT´óСдµÄ¹Øϵ£¬×îºóÒ»ÌõºÍÆäËûÁ½ÌõÔÚQCÀï¿Ï¶¨ÊÇÓõIJ»Ò»ÑùµÄ´æ´¢Î»Ö᣶øµÚÒ»ÌõºÍµÚ¶þÌõ£¬Çø±ðÔÚÓÚºóÕßÓиö×¢ÊÍ£¬
ÔÚ²»Í¬¿Í»§¶Ë£¬»áÓв»Ò»ÑùµÄ½á¹û¡£ËùÒÔ£¬±£ÏÕÆð¼û£¬Ç뾡Á¿²»ÒªÊ¹Óö¯Ì¬µÄ×¢ÊÍ¡£ÔÚPHPµÄmysqlÀ©Õ¹ÀSQLµÄ×¢ÊÍÊDz»»á±»È¥µôµÄ¡£Ò²¾ÍÊÇÈýÌõ
SQL»á±»´æ´¢ÔÚÈý¸ö²»Í¬µÄ»º´æÀËäÈ»ËüÃǵĽá¹û¶¼ÊÇÒ»ÑùµÄ¡£
select * from people where name='surfchen';
select * from people where name='surfchen';
SELECT * from people where name='surfchen';
Ä¿Ç°Ö»ÓÐselectÓï¾ä»á±»cache£¬ÆäËûÀàËÆshow,useµÄÓï¾äÔò²»»á±»cache¡£
ÒòΪQCÊÇÈç´ËÇ°¶Ë£¬Èç´Ë¼òµ¥µÄÒ»¸ö»º´æϵͳ£¬ËùÒÔÈç¹ûÒ»¸ö±í±»¸üУ¬ÄÇôºÍÕâ¸ö±íÏà¹ØµÄSQLµÄËùÓÐQC¶¼»á±»Ê§Ð§¡£¼ÙÉèÒ»¸öÁªºÏ²éѯÀïÉæ¼°µ½Á˱íAºÍ±íB£¬Èç¹û±íA»òÕß±íBµÄÆäÖÐÒ»¸ö±»¸üУ¨update»òÕßdelete£©£¬Õâ¸ö²éѯµÄQC½«»áʧЧ¡£
Ò²¾ÍÊÇ˵£¬Èç¹ûÒ»¸ö±í±»Æµ·±¸üУ¬ÄÇô¾ÍÒª¿¼ÂÇÇå³þ¾¿¾¹ÊÇ·ñÓ¦¸Ã¶ÔÏà¹ØµÄһЩSQL½øÐÐQCÁË¡£Ò»¸ö±»Æµ·±¸üеıíÈç¹û±»Ó¦ÓÃÁËQC£¬¿ÉÄÜ»á¼ÓÖØÊý¾Ý¿âµÄ
¸ºµ££¬¶ø²»ÊǼõÇḺµ£¡£ÎÒÒ»°ãµÄ×ö·¨ÊÇĬÈÏ´ò¿ªQC£¬¶ø¶ÔһЩÉ漰Ƶ·±¸üеıíµÄSQLÓï¾ä¼ÓÉÏSQL_NO_CACHE¹Ø¼ü´ÊÀ´¶ÔÆä½ûÓÃCACHE¡£Õâ
Ñù¿ÉÒÔ¾¡¿ÉÄܱÜÃâ²»±ØÒªµÄÄÚ´æ²Ù×÷£¬¾¡¿ÉÄܱ£³ÖÄÚ´æµÄÁ¬ÐøÐÔ¡£
ÄÇЩ²éѯºÜ·ÖÉ¢µÄSQLÓï¾ä£¬Ò²²»Ó¦¸ÃʹÓÃQC¡£ÀýÈçÓÃÀ´²éѯÓû§ºÍÃÜÂëµÄÓï¾ä——“select pass from user where
name='surfchen'”¡£ÕâÑùµÄÓï¾ä£¬ÔÚÒ»¸öϵͳÀºÜÓпÉÄÜÖ»ÔÚÒ»¸öÓû§µÇ½µÄʱºò±»Ê¹Óá£Ã¿¸öÓû§µÄµÇ½ËùÓõ½µÄ²éѯ£¬¶¼ÊDz»Ò»ÑùµÄSQL
Îı¾£¬QCÔÚÕâÀï¾Í¼¸ºõ²»Æð×÷ÓÃÁË£¬ÒòΪ»º´æµÄÊý¾Ý¼¸ºõÊDz»»á±»Óõ½µÄ£¬ËüÃÇÖ»»áÔÚÄÚ´æÀïÕ¼µØ·½¡£
´æ´¢¿é
ÔÚ±¾½ÚÀï“´æ´¢¿é”ºÍ“block”ÊÇͬһ¸öÒâ˼
QC»º´æÒ
Ïà¹ØÎĵµ£º
ÔÚJavaEye¿´µ½ÒÔϵÄÄÚÈÝ£¬Á´½ÓµØÖ·£ºhttp://www.javaeye.com/news/13062-mysql£¬Ï£Íûϲ°®MySqlµÄÅóÓÑÃÇÒ»ÆðÖ§³Ö¡£
ÇëÔ¸ÊéµØÖ·£ºhttp://helpmysql.org/cn/petition
Ç×°®µÄÕü¾ÈMySQLµÄÖйúÇ©ÃûÖ§³ÖÕß:
Å·ÃË¿ÉÄÜÎÞ·¨Õü¾ÈMySQL, ÖйúºÍ¶íÂÞ˹¿ÉÄÜÊÇÕü¾ÈMySQLµÄÏ£ÍûÖ®ËùÔÚ¡£ÖйúÓµÓÐÇ¿´ó¡¢¶ÀÁ¢ÒÔ¼°×ÔÐŵ ......
create database sample;
create table 't_user' (
'id' int(11) not null auto_increment,
'name' varchar(100) not null default '',
primary key ('id')
) type=myisam;
Ñ¡ÏîÖ»ÔÚMySQL 3.23ºÍÒÔºó°æ±¾Öб»ÊµÏÖ¡£
²»Í¬µÄ±íÀàÐÍÊÇ£º
ISAM ÔÀ´µÄ±í´¦ÀíÆ ......
//µÃ·Ö¼ÆËãËÄÉáÎåÈë
SELECT ROUND((SUM(getfeng)/SUM(totalfeng))*100) as feng from answerdata WHERE uid='151' AND targetid IS NOT NULL
1.ceil £¨£© /ceiling£¨£© ÏòÉÏÈ¡Õû
Àý£º ceil£¨1.2£© = 2
2.floor £¨£© ÏòÏÂÈ¡Õû
Àý£º floor£¨1.2£© = 1
3.round£¨£© ËÄÉáÎåÈë
&n ......