首页 > 数据库技术 > 详细

MySQL: Speed of INSERT Statements

时间:2015-06-20 16:59:21      阅读:325      评论:0      收藏:0      [点我收藏+]

Speed of INSERT Statements

To optimize insert speed, combine many small operations into a single large operation. Ideally, you make a single connection, send the data for many new rows at once, and delay all index updates and consistency checking until the very end.

The time required for inserting a row is determined by the following factors, where the numbers indicate approximate proportions:

  • Connecting: (3)

  • Sending query to server: (2)

  • Parsing query: (2)

  • Inserting row: (1 × size of row)

  • Inserting indexes: (1 × 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:

 

REF:

http://dev.mysql.com/doc/refman/5.0/en/insert-speed.html

http://dev.mysql.com/doc/refman/5.0/en/update-speed.html

MySQL: Speed of INSERT Statements

原文:http://www.cnblogs.com/emanlee/p/4590663.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!