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

ÓÉdzÈëÉî½²½âMySQLÊý¾Ý¿âË÷ÒýµÄÑ¡ÔñÐÔ Êý¾Ý¿âË÷Òý

ÔÚMySQLÖУ¬¶ÔÓÚË÷ÒýµÄʹÓò¢ÊÇÒ»Ö±¶¼²ÉÓÃÕýÈ·µÄ¾ö¶¨¡£
¡¡¡¡¼òµ¥±íµÄʾÀý£º
¡¡¡¡create TABLE `r2` (
¡¡¡¡ID` int(11) DEFAULT NULL,
¡¡¡¡ID1` int(11) DEFAULT NULL,
¡¡¡¡CNAME` varchar(32) DEFAULT NULL,
¡¡¡¡KEY `ID1` (`ID1`)
¡¡¡¡) ENGINE=MyISAM DEFAULT charSET=latin1
¡¡¡¡select count(*) from r2;
¡¡¡¡250001 (V1)
¡¡¡¡select count(*) from r2 where ID1=1;
¡¡¡¡83036 (V2)
¡¡¡¡(execution time = 110 ms)
¡¡¡¡(ID1=1)Ìõ¼þ²éѯË÷ÒýµÄÑ¡ÔñÐÔÊÇ V2/V1 = 0.3321 »ò 33.21%
¡¡¡¡Ò»°ãÀ´Ëµ(ÀýÈçÊé “SQL Tuning“),Èç¹ûÑ¡ÔñÐÔ³¬¹ý 20% ÄÇôȫ±íɨÃè±ÈʹÓÃË÷ÒýÐÔÄܸüÓÅ¡£
¡¡¡¡ÎÒÖªµÀOracleÒ»Ö±ÊÇÔÚÑ¡ÔñÐÔ³¬¹ý25%ʱ»áÑ¡ÔñÈ«±íɨÃè¡£
¡¡¡¡¶øMySQLÄØ:
¡¡¡¡mysql> EXPLAIN select count(SUBNAME) from r2 where ID1=1;
¡¡¡¡+----+-------------+-------+------+---------------+-----
¡¡¡¡| id | select_type | TABLE | type | possible_keys | KEY | key_len | ref | rows | Extra |
¡¡¡¡+----+-------------+-------+------+---------------+-----
¡¡¡¡| 1 | SIMPLE | t2 | ref | ID1 | ID1 | 5 | const | 81371 | USING where |
¡¡¡¡+----+-------------+-------+------+---------------+-----
¡¡¡¡Õâ¾ÍÊÇMySQL½«»áʹÓÃË÷ÒýÀ´Íê³ÉÕâ¸ö²éѯ¡£
¡¡¡¡ÈÃÎÒÃÇÀ´¶Ô±ÈË÷Òý²éѯºÍÈ«±íɨÃèµÄÖ´ÐÐʱ¼ä:
¡¡¡¡select count(SUBNAME) from t2 where ID1=1 - 410 ms
¡¡¡¡select count(SUBNAME) from t2 IGNORE INDEX (ID1) where ID1=1 - 200 ms
¡¡¡¡ÈçÄãËù¿´µ½È«±íɨÃèÒª¿ì2±¶¡£
¡¡¡¡²Î¿¼¸üÌØÊâµÄÀý×Ó£ºÑ¡ÔñÐÔ ~95%:
¡¡¡¡select cnt2 / cnt1 from (select count(*) cnt1 from r2) d1, (select count(*) cnt2 from r2 where ID1=1) d2;
¡¡¡¡0.9492 = 94.92%;
¡¡¡¡ËµÃ÷MySQL½«»áÓÃË÷ÒýÀ´Íê³É²éѯ¡£
¡¡¡¡Ö´ÐÐʱ¼ä:
¡¡¡¡select count(SUBNAME) from t2 where ID1=1 - 1200 ms
¡¡¡¡select count(SUBNAME) from t2 IGNORE INDEX (ID1) where ID1=1 - 260 ms
¡¡¡¡Õâ´ÎÈ«±íɨÃèÒª¿ì4.6±¶¡£
¡¡¡¡ÎªÊ²Ã´MySQLÑ¡ÔñË÷Òý·ÃÎʲéѯ?
¡¡¡¡MySQLûÓмÆËãË÷ÒýµÄÑ¡ÔñÐÔ£¬Ö»ÊÇÔ¤²âÂß¼­IO²Ù×÷µÄÊýÁ¿£¬²¢ÇÒÎÒÃǵÄÀý×ÓÖмäµÄÂß¼­IOÊýÁ¿£¬Ë÷Òý·ÃÎÊÒªÉÙÓÚÈ«±íɨÃè¡£
¡¡¡¡×îºóÎÒÃǵóö½áÂÛ£¬¶ÔÓÚË÷ÒýҪСÐÄʹÓã¬ÒòΪËüÃDz¢²»ÄÜ°ïÖúËùÓеIJéѯ¡£
Ô­ÎÄÀ´×Ô£ºÓê·ã¼¼Êõ½Ì³ÌÍø http://www.fengfly.com
Ô­ÎÄÍøÖ


Ïà¹ØÎĵµ£º

¾ßÓиºÔؾùºâ¹¦ÄÜMySQL·þÎñÆ÷¼¯Èº²¿ÊðʵÏÖ


¾ßÓиºÔؾùºâ¹¦ÄÜMySQL·þÎñÆ÷¼¯Èº²¿ÊðʵÏÖ
http://www.realure.cn/2009_241.html
http://www.realure.cn/2009_242.html
http://www.realure.cn/2009_243.html
http://www.realure.cn/2009_244.html
http://www.realure.cn/2009_245.html ......

ÅäÖÃMySQLÖ÷´Ó¸´ÖÆ(Replication)


ÅäÖÃMySQLÖ÷´Ó¸´ÖÆ(Replication)
±êÇ©£ºÖªÊ¶/̽Ë÷ mysql¸´ÖÆ replication mysql±¸·Ý 
·ÖÀࣺÊý¾Ý¿â
MySQLÖ§³Öµ¥Ïò¡¢Òì²½¸´ÖÆ£¬¸´Öƹý³ÌÖÐÒ»¸ö·þÎñÆ÷³äµ±Ö÷·þÎñÆ÷£¬¶øÒ»¸ö»ò¶à¸öÆäËü·þÎñÆ÷³äµ±´Ó·þÎñÆ÷¡£Ö÷·þÎñÆ÷½«¸üÐÂдÈë¶þ½øÖÆÈÕÖ¾Îļþ£¬²¢Î¬»¤ÈÕÖ¾ÎļþµÄÒ»¸öË÷ÒýÒÔ¸ú×ÙÈÕ־ѭ»·¡£µ±Ò»¸ö´Ó·þÎñ ......

mysql 1366´íÎ󣬱£´æÖÐÎĵķ½·¨

³õѧmysqlÎÒÒ²Åöµ½ÖÐÎÄ´æ´¢µÄÎÊÌ⣬ÒÔÏÂÊÇÎҵĽâ¾ö·½°¸£º
 1.Ê×ÏÈÔÚ×Ö¶ÎÑ¡Ïîcolumn option Öн«×Ö¶Î×Ö·û¼¯column charsetÉèΪgb2312¡£
 2.»¹ÐèÒªÔÚ±íÑ¡Ïîtable option ÖÐͬÑù½«charsetÉèÖÃΪgb2312.
 3.×îºóÈç¹û»¹²»ÐУ¬¾ÍÔÚmysql°²×°Ä¿Â¼ÏÂÕÒµ½my.ini,ÕÒµ½ÒÔÏÂλÖãº
 [mysql]
 default-cha ......

MysqlÊý¾Ý¿âÓû§ÈÏÖ¤µÄÎÊÌâ


Õâʱ¼äÔÚ°²×°PHPBBµÄÂÛ̳£¬·¢ÏÖÒ»¸öÎÊÌ⣬ÄǾÍÊÇÊäÈëÓû§Ãû¸úÃÜÂëºó£¬µã»÷°²×°£¬×ÜÊDZ¨ÁËÒÔϵĴíÎó£º
 ³ÌÐò´úÂë
ORA-28008: invalid old password
Cause: old password supplied is wrong; Hence user cannot be authenticated using old password
Action: Supply the correct old password for authenticatio ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ