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

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


Ïà¹ØÎĵµ£º

VB6.0ÈçºÎÓà libmySQL.dll API·ÃÎÊMYSQLÊý¾Ý¿â

MYSQL Ó¦ÓÃÊ®·Ö¹ã·¶£¬ºÜ¶àÍøÕ¾¼¸ºõ¶¼ÔÚÓÃËû£¬ÒòΪËûµÄСÇɺÍÁé»îÐԵȷ½ÃæÈÃÎÒ¾ö¶¨Òª¶ÔËû½øÐÐÑо¿£¬µ½ÏÖÔÚÒѾ­³É¹¦µÄ²»Óþ­¹ýODBC£¬ADOµÈ·½Ê½¾Í¿ÉÒÔ¶ÁÈ¡ºÍ¸üÐÂÊý¾Ý¡£
 
ºÃÁ˲»¶àÂÞ࣬ÒÔÏÂÎÒÀ´½éÉÜ×ܸö³ÌÐòµÄϸ½Ú:
 
£¨Ò»£©APIÉùÃ÷
 
1.  '·ÖÅä»ò³õʼ»¯ÊʺÏmysql_real_connect()µÄÒ»¸öMYSQL¶ÔÏñ¡ ......

mysql sqlÓï¾äÖеÄlimitÓ÷¨

1¡¢select * from tablename <Ìõ¼þÓï¾ä> limit 100,15
´Ó100Ìõ¼Ç¼ºó¿ªÊ¼(²»°üÀ¨µÚ100Ìõ¼Ç¼)È¡³ö15Ìõ¼Ç¼ (ʵ¼ÊÈ¡³öµÄÊÇµÚ 101-115Ìõ¼Ç¼Êý¾Ý) 
2¡¢select * from tablename <Ìõ¼þÓï¾ä> limit 15
È¡³ö ǰ15Ìõ¼Ç¼Êý¾Ý,limit 15Ï൱ÓÚ limit 0,15 ......

MYSQL »ñÈ¡µ±Ç°ÈÕÆÚ¼°ÈÕÆÚ¸ñʽ

MYSQL »ñÈ¡µ±Ç°ÈÕÆÚ¼°ÈÕÆÚ¸ñʽ
   »ñȡϵͳÈÕÆÚ£º  NOW()
   ¸ñʽ»¯ÈÕÆÚ£º    DATE_FORMAT(date, format)
               ×¢£º   date£ºÊ±¼ä×Ö¶Î
       ......

tomcatÁ´½Ó³ØÁ´½ÓMysqlÊý¾Ý¿âÖÐÎÄÂÒÂë½â¾ö°ì·¨

1¡¢Ê×ÏÈ×Ô¼ºÐ½¨µÄÊý¾Ý¿â±àÂë¸ñʽÉèΪUTF-8
2¡¢½«mysql-connector-java-5.1.6-bin¿½±´µ½tomcat\LibĿ¼Ï¡£
3¡¢ÐÞ¸ÄTomcat\conf\ϵÄcontext.xmlÎļþÄÚÈÝÈçÏ£º
<Context>
 <WatchedResource>WEB-INF/web.xml</WatchedResource>
 <Resource
  name="jdbc/mysqlds"
  t ......

´ÓMySQLÖлñµÃÊý¾Ý±íauto_incrementÖµµÄ·½·¨

ÎÊÌâÊÇÕâÑùµÄ£ºÔÚ²åÈëÒ»ÐÐÊý¾Ýǰ¾ÍÏëÒªÖªµÀ½«Òª²úÉúµÄid¡£±ÈÈç˵ÏëÓÃÀ´ÃüÃûÉÏ´«µÄÎļþ¡£Èç¹û²»ÊÂÏÈ»ñµÃid¾Í²»ÖªµÀÎļþÃû£¬¾Íû·¨ÔÚ²åÈëʱ°ÑÎļþ·¾¶±£´æµ½Êý¾Ý¿âÀïÁË¡£Èç¹û²»ÐèÒªÊÂÏÈ»ñµÃid£¬´ó¿ÉÒÔÔÚ²åÈëºóµ÷ÓÃmysql_insert_id()»òÕßÖ´ÐÐselect last_insert_id()£¬¾Í²»±ØÍùÏ¿´ÁË¡£ÎªÁËÕÕ¹ËÐÔ¼±µÄͬѧ£¬Ïȸø´ð°¸£º
$resul ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ