Mysql Explain Ïê½â[Ç¿ÁÒÍƼö]
Mysql Explain Ïê½â
Ò».Óï·¨
explain < table_name >
ÀýÈç: explain select * from t3 where id=3952602;
¶þ.explainÊä³ö½âÊÍ
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
1.id
ÎÒµÄÀí½âÊÇSQLÖ´ÐеÄ˳ÀûµÄ±êʶ,SQL´Ó´óµ½Ð¡µÄÖ´ÐÐ.
ÀýÈç:
mysql> explain select * from (select * from ( select * from t3 where id=3952602) a) b;
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
| 1 | PRIMARY | <derived2> | system | NULL | NULL | NULL | NULL | 1 | |
| 2 | DERIVED | <derived3> | system | NULL | NULL | NULL | NULL | 1 | |
| 3 | DERIVED | t3 | const | PRIMARY,idx_t3_id | PRIMARY | 4 | | 1 | |
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
ºÜÏÔÈ»ÕâÌõSQLÊÇ´ÓÀïÏòÍâµÄÖ´ÐÐ,¾ÍÊÇ´Óid=3 ÏòÉÏÖ´ÐÐ.
2. select_type
¾ÍÊÇselectÀàÐÍ,¿ÉÒÔÓÐÒÔϼ¸ÖÖ
(1) SIMPL
Ïà¹ØÎĵµ£º
1.Èç¹û¿Í»§¶ËºÍ·þÎñÆ÷¶ËµÄÁ¬½ÓÐèÒª¿çÔ½²¢Í¨¹ý²»¿ÉÐÅÈεÄÍøÂ磬ÄÇô¾ÍÐèҪʹÓÃSSHËíµÀÀ´¼ÓÃܸÃÁ¬½ÓµÄͨÐÅ¡£
¡¡¡¡2.ÓÃset passwordÓï¾äÀ´ÐÞ¸ÄÓû§µÄÃÜÂ룬Èý¸ö²½Ö裬ÏÈ“mysql -u root”µÇ½Êý¾Ý¿âϵͳ£¬È»ºó“mysql> update mysql.user s ......
°²×°mysql
sudo apt-get install mysql-server #Ö±½Ó×Ô¶¯»ñµÃ¿ÉÓð汾
Ò²¿ÉÒÔÕâÑùд
sudo apt-get install mysql-server-5.0 #°²×°mysql·þÎñÆ÷5.0°æ±¾
°²×°ºó
/etc/init.d/mysql start (stop) ΪÆô¶¯ºÍÍ£Ö¹·þÎñÆ÷
/etc/mysql/ Ö÷ÒªÅäÖÃÎļþËùÔÚλÖà my.cnf
/var/lib/mysql/ ·ÅÖõÄÊÇÊý¾Ý¿â±íÎļþ¼Ð£¬ÕâÀïµÄm ......
MySQL´¥·¢Æ÷
Ò»¡¢ MySQL´¥·¢Æ÷¸ÅÄî
MySQL5.0ÒÔÉÏ°æ±¾Ö§³Ö´¥·¢Æ÷£¬´¥·¢Æ÷ÊÇÓë±íÓйصÄÃüÃûÊý¾Ý¿â¶ÔÏ󣬵±±í³öÏÖÌض¨Ê¼þʱ£¬½«¼¤»î¸Ã¶ÔÏó¡£
¶þ¡¢ MySQL´¥·¢Æ÷Óï·¨
CREATE TRIGGER trigger_name trigger_time trigger_event
ON tbl_name FOR EACH ROW trigger_stmt
trigger ......
2009-12-08 18:53
sql½Å±¾ÊÇ°üº¬Ò»µ½¶à¸ösqlÃüÁîµÄsqlÓï¾ä£¬ÎÒÃÇ¿ÉÒÔ½«ÕâЩsql½Å±¾·ÅÔÚÒ»¸öÎı¾ÎļþÖУ¨ÎÒÃdzÆ֮Ϊ“sql½Å±¾Îļþ”£©£¬È»ºóͨ¹ýÏà¹ØµÄÃüÁîÖ´ÐÐÕâ¸ösql½Å±¾Îļþ¡£»ù±¾²½ÖèÈçÏ£º
1¡¢´´½¨°üº¬sqlÃüÁîµÄsql½Å±¾Îļþ
ÎļþÖаüº¬Ò»Ð©ÁеÄsqlÓï¾ä£¬Ã¿ÌõÓï¾ä×îºóÒÔ;½á⣬ÎļþÄÚÈÝʾÀýÈçÏ£º
--´´½ ......
¾³£ÔÚÒ»¸ö±íÖÐÓи¸×Ó¹ØϵµÄÁ½¸ö×ֶΣ¬±ÈÈçempnoÓëmanager£¬ÕâÖֽṹÖÐÐèÒªÓõ½Ê÷µÄ±éÀú¡£ÔÚOracle ÖпÉÒÔʹÓÃconnect by¼òµ¥½â¾öÎÊÌ⣬²Î¼ûhttp://blog.csdn.net/ylqmf/archive/2010/01/11/5172866.aspx£¬µ«MySQL 5.1Öл¹²»Ö§³Ö£¨¾Ý˵ÒÑÄÉÈëto doÖУ©£¬Òª×Ô¼ºÐ´¹ý³Ì»òº¯ÊýÀ´ÊµÏÖ¡£
Ò»¡¢½¨Á¢²âÊÔ±íºÍÊý¾Ý£º
view plaincop ......