mysqlËæ»úÊý¾ÝÉú³É²¢²åÈë
dblpÊý¾Ý¿âÖÐÒýÓÃÐÅÏ¢ºÜÉÙ£¬Æ½¾ùһƪÂÛÎÄÒýÓÃ0.2ƪ¡£Ê¹ÓÃdblp×öʵÑéÊý¾Ý¼¯µÄijƪÂÛÎÄÌáµ½£¬¿ÉÒÔËæ»úÌí¼ÓÒýÓÃÐÅÏ¢¡£ÊÜ´ËÆô·¢£¬ÎÒ´òËãΪÿһƪÂÛÎĶ¼Ìí¼Ó20ƪËæ»úÒýÓã¬ÓÚÊǾÍд³öÁËÈçϵÄsqlÓï¾ä£º
String sql = "insert into citation(pId1,pId2) values( (select pId from papers limit ?,1),(select pId from papers
limit ?,1))";
ʹÓÃpreparedstatement£¬ÒÔbatch·½Ê½Ìá½»Êý¾Ý¿â¡£
µÚÒ»¸ö²ÎÊýÊÇpaperµÄrowidÐÅÏ¢£¬´Ó0~N£¨NΪpapersµÄtotal row£©¡£µÚ¶þ¸ö²ÎÊýÊÇjavaÉú³ÉµÄ20¸ö²»Öظ´µÄËæ»úÊý£¬·¶Î§ÊÇ0-N¡£È»ºóǶÌ×ÔÚforÑ»·Àÿ1wÌõÊý¾ÝÌá½»¸øÊý¾Ý¿âÒ»´Î¡£
Õâ¶Î´úÂëÇÉÃîÔËÓÃlimitµÄÌØÐÔÍê³ÉËæ»úÑ¡tuple£¬±¾À´ÊÇ°µ°µµÃÒâµÄ¡£×ÔÒÔΪ°ÑËùÓеÄselect¶¼½»¸øÊý¾Ý¿âÈ¥×öÁË£¬Ê¡È¥ÁËͨ¹ýjdbcµÄ¶à´ÎÁ¬½Ó£¬Ó¦¸ÃÊǺܿì¾Í¿ÉÒÔÔËÐÐÍê³ÉµÄ¡£ÄÄÖª£¬²åÁ˲»¹ý10wÌõ£¨10000*10£©Êý¾Ý£¬¾ÍºÄʱ22·ÖÖÓÖ®¶à¡£×îÖÕµÄʵÑéÐèÒª²åÈë400wÌõÊý¾Ý£¬Ò²¾ÍÊÇ˵Ҫ»¨14h×óÓÒ¡£
ÓÚÊÇ¿ªÊ¼·´Ë¼£¬²»¶Ï×öдÀàËƵijÌÐò²éÕÒʱ¼äÆ¿¾±£¬×îÖÕËø¶¨ÔÚselect limit£¬Õâ¸ö²Ù×÷¼«ºÄʱ¼ä¡£µ±³õÑ¡ÓÃlimit£¬ÔÒòÔÚÓÚ£ºËæ»úÉú³ÉµÄÊÇÊý×Ö£¬Òª°ÑÊý×ÖÓ³Éäµ½tuple£¬Ò²¾ÍÊǶÔÓ¦µ½rowid£»ÓÉÓÚpapers±íµÄÖ÷¼ü²¢·ÇµÝÔöint£¬ËùÒÔĬÈϵÄrowid²»´æÔÚ¡£ºóÀ´Ò»Ï룬¿ÉÒÔÔÚpapers±íÉÏÏÈÔö¼ÓÒ»¸öauto_incrementµÄtempÁУ¬Íê³Écitation²åÈëºóÔÙɾ³ý¡£ÕâÑùsqlÓï¾ä¾Í¸Ä³ÉÁË£º
String sql = "insert into citation(pId1,pId2) values((select pId from papers where temp=?), (select pId from
papers where temp=?))";
ÔÙÒ»´Î²åÈë10wÌõÊý¾Ý£¬ºÄʱ38s¡£Ð§ÂÊ´ó·ùÌá¸ß£¬µ«²»ÖªµÀ»¹¿É²»¿ÉÒÔ½øÒ»²½ÓÅ»¯¡£
Ïà¹ØÎĵµ£º
½ñÌìÁ·Ï°ÔÚJSPÒ³ÃæÖÐʵÏÖ·ÖҳЧ¹û£¬ÔÚ²éѯÓï¾ä·½ÃæÇ£³¶µ½ÁËtopµÄÓ÷¨¡£¼òÒª×öÒ»ÏÂ×ܽ᣺
ΪʵÏÖÀàËÆtopµÄ¹¦ÄÜ£¬ÎÒÃÇÔÚSQL ServerÖкÍMySQLÖÐʹÓõ½µÄSQLÓï¾äÊDz»Í¬µÄ¡£
1¡¢ÔÚSQL ServerÖУ¬ÎÒÃÇʹÓà select top N * ......
¹ýÂËÆ÷Ìõ¼þ
mysql.query contains "SELECT"
..
..
..
..
MySQL Protocol
Packet Length: 168
Packet Number: 0
Command
Command: Query (3)
State ......
MySQL¼¯ÈºÊÇÒ»ÖÖÔÚÎÞ¹²Ïí¼Ü¹¹ÏµÍ³ÀïÓ¦ÓÃÄÚ´æÊý¾Ý¿â¼¯ÈºµÄ¼¼Êõ¡£ÕâÖÖÎÞ¹²ÏíµÄ¼Ü¹¹¿ÉÒÔʹµÃϵͳʹÓ÷dz£±ãÒ˵IJ¢ÇÒÊÇ×îСÅäÖõÄÓ²¼þ¡£
MySQL¼¯ÈºÊÇÒ»ÖÖ·Ö²¼Ê½Éè¼Æ£¬Ä¿±êÊÇÒª´ïµ½Ã»ÓÐÈκε¥µã¹ÊÕϵ㡣Òò´Ë£¬ÈκÎ×é³É²¿·Ö¶¼Ó¦¸ÃÓµÓÐ×Ô¼ºµÄÄÚ´æºÍ´ÅÅÌ¡£Èκι²Ïí´æ´¢·½°¸ÈçÍøÂç¹²Ïí£¬ÍøÂçÎļþϵͳºÍSANÉ豸ÊDz»ÍƼö»ò²»Ö ......
ÒýÑÔ
¡¡¡¡Êý¾Ý¿âµÄÉè¼Æ·¶Ê½ÊÇÊý¾Ý¿âÉè¼ÆËùÐèÒªÂú×ãµÄ¹æ·¶£¬Âú×ãÕâЩ¹æ·¶µÄÊý¾Ý¿âÊǼò½àµÄ¡¢½á¹¹Ã÷ÎúµÄ£¬Í¬Ê±£¬²»»á·¢Éú²åÈ루insert£©¡¢É¾³ý£¨delete£©ºÍ¸üУ¨update£©²Ù×÷Òì³£¡£·´Ö®ÔòÊÇÂÒÆß°ËÔ㣬²»½ö¸øÊý¾Ý¿âµÄ±à³ÌÈËÔ±ÖÆÔìÂé·³£¬¶øÇÒÃæÄ¿¿ÉÔ÷£¬¿ÉÄÜ´æ´¢ÁË´óÁ¿²»ÐèÒªµÄÈßÓàÐÅÏ¢¡£
¡¡¡¡Éè¼Æ·¶Ê½ÊDz»ÊǺÜÄѶ®ÄØ£¿·ÇÒ² ......
½ñÌì°²×°mysqlÓöµ½ºÜ¶àÂé·³£¬ÏëÏóÔÒò£¬×Ô¼º»¹ÊÇlinuxµÄ³õѧÕߣ¬Í¬Ê±ÊÜ´ìʱ×ÜÊÇÒª°ÑÎÊÌâµÄ¸´ÔÓϵÊý·Å´ó¡£
1 °²×°³åÍ»
¸ù¾Ý¡¶linux³ÌÐòÉè¼Æ¡·ÉϵÄÖ¸µ¼£¬´Ó¹ÙÍøÏÂÔØÁËmysql-server-xx£¬mysql-devel-xx£¬mysql-client-xx£¬mysql-share-xx£¬È»ºóÖ´ÐÐ
rpm -i *.rpm
½á¹û¶þÊ®¼¸ÐÐconflictÌáʾ£¬ËµÓÐÎļþÓëmysql-server-xxµÄ°² ......