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

ÈçºÎд³ö¸ßÐÔÄܵÄMySQL²éѯ

ÏëдÕâÑùһƪÎÄÕºܾÃÁË£¬µ«Ê¼ÖÕûÓÐÏÂÊÖ¡£×î½ü°ïͬÊ¿´Á˼¸¸ö²éѯ£¬¶øÇÒ×Ô¼ºÒ²ÔÚ¿¼ÂÇÒ»¸öË÷ÒýϵͳµÄÎÊÌ⣬ËùÒÔ½ñÌì¾Í°ÑÕâ¸öдÁË¡£½éÉÜÒ»ÏÂMySQLµÄË÷Òý»úÖÆ£¬»¹ÓÐһЩMySQL²éѯµÄÓÅ»¯²ßÂÔ¡£±ÉÈ˲ÅÊèѧdz£¬ºÜ¿ÉÄÜ˵µÄ²»¶Ô£¬Çë·¹ýµÄ¸÷λ´óÏÀÅúÆÀÖ¸Õý£¬Ï׳óÁË¡£
------------------- jiajun.org ¹Ù·½·Ö¸îÏß ---------------------
Ê×ÏÈ£¬ËµËµMySQLµÄË÷Òý´æ´¢·½Ê½¡£MySQLµÄË÷ÒýÒ»°ãÊÇB-TreeµÄ½á¹¹´æ´¢µÄ£¬ÄÚ´æ±íÒ²ÓÐHashË÷Òý£¬µ«ÊÇÄÚ´æ±íµÄ³ö¾µÂÊËƺõÒѾ­µÍµ½ÁËÓÓ¿ÉÁ¯”À´ÐÎÈݵij̶ȣ¬ËùÒÔÎÒÃÇÖ»¿¼ÂÇB-TreeË÷Òý¡£
È»ºó˵˵MySQLµÄÁªºÏË÷Òý¡£ÁªºÏË÷Òý¶ÔÓÚÒ»¸öDBMS×ÜÊǷdz£ÖØÒªµÄ£¬ÒòΪÿһÌõSQLÓï¾äµÄÌõ¼þ×Ó¾äÊǵ¥Ìõ¼þµÄ¿ÉÄÜÐÔºÜС£¬´ó¶àÊýÇé¿öÏÂΪ×éºÏÌõ¼þ£¬Òò´Ë¶ÔÓÚ×éºÏË÷ÒýµÄÒÀÀµÒ²¾ÍºÜÇ¿¡£MySQL¶ÔÓÚÁªºÏË÷ÒýµÄ´´½¨¹æÔòͨ¹ýÒ»¸öÀý×Ó˵Ã÷£º
¶ÔÓÚÒ»¸öÔÚÁУºcol_a, col_bºÍcol_cÉϵÄÁªºÏË÷Òý£¬MySQL»á½¨Á¢
INDEX(col_a), INDEX(col_a, col_b)ºÍINDEX(col_a, col_b, col_c)
ÕâÑùÈý¸öË÷Òý¡£
½éÉÜÍêһЩ»ù±¾Ô­Àí£¬ÎÒÃÇÀ´¿´MySQL¶ÔÓÚË÷ÒýµÄÑ¡È¡¹æÔòºÍË÷ÒýµÄ½¨Á¢Ô­Ôò£¨ÕâЩ¹æÔò¶¼ÊǸöÈË×ܽáµÄ£¬¶àÀ´Ô´ÓÚ»¥ÁªÍø£¬Ò²ÓÐ×Ô¼ºµÄ¾­Ñ飩¡£
¶ÔÓÚµ¥¸öË÷Òý£¬Ò»°ãÀ´ËµMySQLµÄ²éѯÓÅ»¯Æ÷×ÜÄÜÔÚÈô¸É²éѯÌõ¼þÖÐѡȡЧÂʽϸߵÄÒ»¸öʹÓã¬ËùÒÔ²»±ØͶÈëÌ«¶à¾«Á¦£¬Ò»°ãÀ´Ëµ²éѯÈÝÒ׳öÏÖµÄÎÊÌâÈÝÒ׳öÏÖÔÚÁªºÏË÷Òý¡£ÕâÀïÒÔÒ»¸öÁ½ÁеÄË÷ÒýΪÀý£¬ËµÃ÷һЩÎÊÌâ¡£
ÀýÈ磺
idx_a_b (col_a, col_b)
½¨Á¢×öºÍË÷ÒýµÄÁнøÐÐor×éºÏ²»¿ÉʹÓÃË÷Òý
ÀýÈ磺ÓÐÌõ¼þ
col_a = val_a OR col_b = val_b
Õâ¸öÌõ¼þ£¬ÊDz»¿ÉÒÔʹÓÃidx_a_bË÷ÒýµÄ¡£È»¶øͬÑùµÄ²éѯ¶ÔÓÚÈ´¿ÉÒÔʹÓÃÕâÑùµÄË÷Òýidx_a(col_a)»òÕßidx_b(col_b)µÄ£¬Òò´ËÔÚ½¨Á¢Ë÷ÒýµÄʱºò¾ÍÒª¿¼Âǵ½³ö¾µÂÊ×î¸ßµÄÌõ¼þÊÇʲô£¬½¨Á¢ÔõÑùµÄË÷Òý¡£¶øÈç¹ûͬʱ´æÔÚidx_aºÍidx_bÁ½¸öË÷ÒýµÄ»°£¬MySQLÒ²Ö»»áÑ¡ÔñÒ»¸öʹÓ㬾¡¿ÉÄÜʹÓÃË÷Òý°Ñ½á¹û¼¯ËõС£¬ÔÙÔÚÕâ¸ö½á¹û¼¯ÖбéÀú£¬Ê¹ÓÃÆäËûÌõ¼þɸѡ¡£
ÁªºÏË÷Òý¶Ô·Çǰ׺Áв»ÉúЧ
ÀýÈ磺Ìõ¼þcol_b = val_bÕâ¸öÌõ¼þÊDz»»áʹÓÃÕâ¸öË÷ÒýµÄ£¬ÒòΪË÷Òýidx_a_bµÄǰ׺ÁÐÊÇcol_a¡£Òò´ËÔÚ½¨Ë÷ÒýµÄʱºò£¬¾ÍҪעÒâµ½£¬ÊÇ·ñÓкܶàʹÓÃÕâÖÖÌõ¼þµÄ²éѯ£¬ÐèҪΪcol_bµ¥¶À½¨Á¢Ë÷Òý¡£
¶ÔÓÚ×éºÏË÷Òý£¬Óöµ½·¶Î§²éѯÔò·ÅÆúʹÓÃÊ£Óಿ·Ö
ÀýÈ磺Ìõ¼þ
col_a = val_a AND col_b = val_b
ÊÇ¿ÉÒÔʹÓÃÕû¸öË÷Òý£¬¶ø¶ÔÓÚ
col_a BETWEEN val_a_left AND val_a_right AND col_b = val_b
Õâ¸öÌõ¼þ£¬Ö»»áʹÓÃË÷ÒýµÄcol_


Ïà¹ØÎĵµ£º

Web¿ª·¢±Ê¼Ç2——MySQLÊ°Áã

Ô­ÎÄ£ºhttp://blog.csdn.net/gnuhpc/archive/2010/01/01/5118123.aspx
½ö½öÊÇ¿´Ò»Ð©ÊéÊÇÁãÁãɢɢ¼Çϵģ¬¸ø×Ô¼º±¸Íü¶øÒÑ¡£½¨ÒéÈ¥¿´×¨ÒµÍøÕ¾µÄ±Ê¼Ç¡£
1.Ö÷¼üµÄÖµ±ØÐëÊÇΨһµÄ£¬²¢ÇÒ²»ÄÜΪ¿Õ£¬Õâ¿ÉÒÔÌá¸ßMySQL´Ó¶à¸ö±íÖÐÈ¡µÃÊý¾Ý»òÕßÈ¡µÃÖ¸¶¨¼üÖµ¶ÔÓ¦µÄÐеÄËٶȡ£MySQLͨ¹ýÒ»¸öÌØÊâµÄ³ÆΪIndexË÷ÒýµÄÊý¾Ý½á¹¹×öµ½ÕâÒ»µã£¬In ......

MySQL 5.0.16 ÂÒÂëÎÊÌâ´¦Àí°ì·¨



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 ......

[תÔØ]mysqlµÄСÎÊÌâ

mysql error number 2003   
Can't connect to MySQL server xxx.xxx.xxx.xxx (10061)
ÔÚubuntu 9.04ÖÐĬÈÏ°²×°ÁËmysql£¬Ä¬ÈÏÖ»Äܱ¾µØ·ÃÎÊ£¬googleÁËһϣº
²ÉÓÃ
µÇ¼µ½MySQL·þÎñÆ÷¶Ë£¬ÔÚmysql¿âÏÂÖ´ÐÐ
grant all on *.* to 'remote'@'172.16.21.39' identified by 'password';
¼´¿É

Èç¹ûÒªÉèÖÃÎ ......

ÓÃInstallAnywhere´ò°üJava³ÌÐò°üº¬MySQLÊý¾Ý¿â

ÓÃInstallAnywhere´ò°üJava³ÌÐò°üº¬MySQLÊý¾Ý¿â
 
InstallAnywhere´ò°üJava³ÌÐòʱ¿ÉÒÔ×Ô¶¯Íê³ÉjreµÄ´ò°ü£¬µ«ÊÇÐèÒªMySQLÊý¾Ý¿âµÄ³ÌÐò¾ÍµÃÊÖ¶¯Ìí¼Ó¡£×ÊÁÏÌ«ÉÙ£¬¾À½áÁËÈýÌ죬ÖÕÓÚ½â¾ö
 
1¡¢  ÏÂÔØÂÌÉ«°æµÄMySQL£¬¿ÉÒÔÈ¥¹ÙÍøÏÂÔØ¡£ÍøÓÑÖÆ×÷ÁËMySQLµÄÂÌÉ«¾«¼òBat°æ£¨http://download.csdn.net/source/524812 ......

mysql´æ´¢ÒýÇæÖ® InnoDB

InnoDB¸ÅÊö
InnoDB¸øMySQLÌṩÁ˾ßÓÐÌá½»£¬»Ø¹öºÍ±ÀÀ£»Ö¸´ÄÜÁ¦µÄÊÂÎñ°²È«£¨ACID¼æÈÝ£©´æ´¢ÒýÇæ¡£InnoDBËø¶¨ÔÚÐм¶²¢ÇÒÒ²ÔÚSELECTÓï¾äÌṩһ¸öOracle·ç¸ñÒ»ÖµķÇËø¶¨¶Á¡£ÕâЩÌØÉ«Ôö¼ÓÁ˶àÓû§²¿ÊðºÍÐÔÄÜ¡£Ã»ÓÐÔÚInnoDBÖÐÀ©´óËø¶¨µÄÐèÒª£¬ÒòΪÔÚInnoDBÖÐÐм¶Ëø¶¨ÊʺϷdz£Ð¡µÄ¿Õ¼ä¡£InnoDBÒ²Ö§³ÖFOREIGN KEYÇ¿ÖÆ¡£ÔÚSQL²éÑ¯Ö ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ