ÈçºÎÌá¸ßMysqlÓï¾ä²åÈëÐÔÄÜ
ÔÚ±íÖÐÒÑÓдóÁ¿µÄindexµÄÇé¿öϲåÈë´óÁ¿Êý¾Ý£¬¿ÉÒÔ²ÉÓÃÏȽ«Ë÷Òýɾ³ý£¬È»ºóÔÙ²åÈëÊý¾Ý£¬È»ºóÔÙÖØÐ½¨Á¢Ë÷Òý¡£Ö®ËùÒÔÕâÑù»á¿ìÊÇÒòΪ£¿£¿£¿
7.2.14 Speed of INSERT Statements
The time to insert a record is determined by the following factors, where the numbers indicate approximate proportions:
* Connecting: (3)
* Sending query to server: (2)
* Parsing query: (2)
* Inserting record: (1 x size of record)
* Inserting indexes: (1 x number of indexes)
* Closing: (1)
This does not take into consideration the initial overhead to open tables, which is done once for each concurrently running query.
The size of the table slows down the insertion of indexes by log N, assuming B-tree indexes.
You can use the following methods to speed up inserts:
* If you are inserting many rows from the same client at the same time, use INSERT statements with multiple VALUES lists to insert several rows at a time. This is much faster (many times faster in some cases) than using separate single-row INSERT statements. If you are adding data to a non-empty table, you may tune the bulk_insert_buffer_size variable to make it even faster. See section 5.2.3 Server System Variables.
* If you are inserting a lot of rows from different clients, you can get higher speed by using the INSERT DELAYED statement. See section 14.1.4 INSERT Syntax.
* With MyISAM tables you can insert rows at the same time that SELECT statements are running if there are no deleted rows in the tables.
* When loading a table from a text file, use LOAD DATA INFILE. This is usually 20 times faster than using a lot of INSERT statements. See section 14.1.5 LOAD DATA INFILE Syntax.
* With some extra work, it is possible to make LOAD DATA INFILE run even faster when the table has many indexes. Use the following pr
Ïà¹ØÎĵµ£º
WordpressÓÃÁËÕâô³¤Ê±¼ä£¬Å¼¶û»áÏëÆðÀ´±¸·ÝÏÂÊý¾Ý£¬ÉÏ´ÎÊÇÓÃwpµÄxml£¬Õâ´Î°Ñ×Ô¼º»úÆ÷µÄ»·¾³ÅäµÄ¸úÖ÷»úÌṩÉÌ»ù±¾Ò»ÑùÁË£¬ÕýºÃÄDZßÓÐmysqlÊý¾Ý¿â´ò°ü±¸·ÝµÄ·þÎñ£¬¾Í³¢ÊÔÁËһϡ£¿É²»¹ÜÎÒÏÂÔØÄĸöʱ¼äµãµÄ±¸·Ý°ü£¬ÀïÃæ¶¼Ö»ÓÐwp±íµÄ10¸öfrmÎļþ£¬copyµ½ÎÒµÄÊý¾Ý¿âĿ¼ºó·ÃÎÊweb£¬Ã»ÓÐÈκÎÊý¾Ý£¡Ö±½Ó¸ã²»¶®ÁË¡£ÒÔǰ¾õµÃÓÃmysql ......
Ê×ÏÈÐèÒªÐ¶ÔØredhat×Ô´øµÄmysqlÊý¾Ý¿â£¨²»È»°²×°Ê±»á³öÎÊÌ⣩
rpm -qa|grep mysql
È»ºó rpm -e °üÃû³Æ
Èç¹ûÉæ¼°µ½ÒÀÀµ£¬¾ÍÏÈɾ³ýÒÀÀµ£¬»òÕß¼Ó¸ö -nodeps ²ÎÊýºöÂÔÒÀÀµ
ÓÐÍøÓÑ˵ÓÃyum -y remove mysqlÒ²¿ÉÒÔ
ÁíÒ»¸ö½â¾ö·½·¨Ê±ÔÚlinux×Ô´ømysql»ù´¡ÉÏÔÙװеÄmysql
¶þ½øÖư²×°°ü°æ±¾ºÜ¶à£¬³£ÓõľÍÁ½¸ö£¬ÎÒϵÄÊÇ ......
SQL #1: select * from uchome_feed where uid in('0',501...) order by dateline desc limit 0,50;
SQL #2: select * from uchome_feed where uid in(0,501...) order by dateline desc limit 0,50;
SQL #1 ÊÇCSDN ¸öÈ˿ռä»ñÈ¡¸öÈ˶¯Ì¬µÄSQL£¬ÊôUCHÔ°æSQL¡£
SQL #2 ÊÇÈ¥µôµ¥ÒýºÅ(SQL #1ÖкìÉ«²¿·Ö)ºóµÄSQL£¬Á½¸ ......
Oracleº¯ÊýºÍmysqlº¯Êý±È½Ï
1. OracleÖеÄto_number()ת»»³ÉÊý×Ö£»
Oracle> Select to_number(‘123’) from dual; ----- 123;
&nbs ......