易截截图软件、单文件、免安装、纯绿色、仅160KB

如何提高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


相关文档:

MySQL中MyISAM引擎与InnoDB引擎性能简单测试


[硬件配置]
CPU : AMD2500+ (1.8G)
内存: 1G/现代
硬盘: 80G/IDE
[软件配置]
OS : Windows XP SP2
SE : PHP5.2.1
DB : MySQL5.0.37
Web: IIS6
[MySQL表结构]
CREATE TABLE `myisam` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(100) default NULL,
  `content` text,
&nbs ......

MySQL转义

MySQL识别下列转义字符:    
   
  \0    
  一个ASCII   0   (NUL)字符。    
  \n    
  一个新行符。    
  \t   &nb ......

mysql alter 语句用法,添加、修改、删除字段等

mysql alter 语句用法,添加、修改、删除字段等
//主键549830479
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//增加一个新列549830479
alter table t2 add d timestamp;
alter table infos add ex tinyint not null default ......

MySQL学习

C API相关
C API数据类型
 MYSQL
该结构代表1个数据库连接的句柄。几乎所有的MySQL函数均使用它。不应尝试拷贝MYSQL结构。不保证这类拷贝结果会有用。
 MYSQL_RES
该结构代表返回行的查询结果(SELECT, SHOW, DESCRIBE, EXPLAIN)。在本节的剩余部分,将查询返回的信息称为“结果集&rdq ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号