别想万里,要把一只脚放到另一脚的前边
分类: Mysql/postgreSQL
2012-06-23 15:32:51
Summary
MySQL has six table types: ISAM, MyISAM, InnoDB, BDB, MERGE, and HEAP.
MySQL 有6 中表类型: ISAM(index sequence access method) ,MYISAM,InnoDB,BDB,MERGE,HEAP 。
Only InnoDB and BDB tables are transaction safe. InnoDB 和BDB 支持事务
Only MyISAM tables support full-text indexing and searching. MySQL 默认的类型MyISAM表支持全文索引。
ISAM
ISAM had been deprecated and superceded by MyISAM.
MyISAM 已经完全课可以替换过去的ISAM 表,留下它只是为了兼容的需要。
ISAM 表有下边多项劣势:
ISAM tables have a hard size limit of 4GB. 一个表最大只能有4G !
ISAM tables are not portable. 平台不兼容,你在windows 上建立一个表,不能跑到linux 上使用。
You can have a maximum of 16 keys per table and a maximum key length of 256 bytes (characters). 对于键的限制: 16键(数量) , 长度上256 限制。
MyISAM
MyISAM is the default table type. It is very fast, but not transaction safe.
MyISAM 支持默认的表类型,快速,不支持事务,支持表的压缩,它的表的限制是操作系统的限制,当然现在又MERGE 表技术可以实现大表。
MyISAM tables support table compression.
The size of MyISAM tables is limited only by the operating system, and this can be worked around with MERGE tables.
The data files that store MyISAM tables are portable from system to system.
You can have a maximum of 64 keys per table and a maximum key length of 1024 bytes.
InnoDB
InnoDB 比较通用的数据表类型了。支持事务,支持到行水平的locking 技术,没有理论上的最大表,你完全可以把一个表分解成多个文件,支持外键。 缺点: 就是占用的disk space 多。
InnoDB tables are transaction safe.
InnoDB supports row-level locking.
There is no theoretical maximum table size because tables may be stored in more than one file.
InnoDB provides consistent nonlocking reads in SELECT.
InnoDB tables are portable from system to system.
InnoDB tables take more disk space than MyISAM tables.
Foreign keys are supported between InnoDB tables.
BDB
这用的是伯克利大学的支持事务的表类型,很少用,所以只介绍,不说明。
Like InnoDB tables, BDB tables are transaction safe. BDB tables are not as widely used with MySQL as InnoDB.
BDB supports page-level locking.
BDB tables are not portable.
MERGE
MERGE tables are used to treat multiple MyISAM tables as a single table, and therefore, the maximum file size limitation is removed from MyISAM tables.
这种技术就可以使MyISAM 的表的大小限制去掉了。 可以摘掉MySQL 只能用于小企业的帽子。
HEAP
HEAP tables are stored only in memory and need to be limited in size to avoid running out of memory.
Data stored in a HEAP table is volatile and will be lost in the event of a power failure.
HEAP tables are super fast, as long as you have enough physical memory to keep them.
HEAP tables do not support AUTO_INCREMENT, TEXT, or BLOB.
这种表主要存储在内存中,临时表的常用类型, 有很多限制: auto_increment ,text,blob 都不支持等。