MYSQL引擎简单对比
服务器业务类型对比 性能瓶颈
DB I/O磁盘
转发服务器 网卡PPS
动态WEB前台 CPU
静态WEB前台 网卡 (流量)
ACID原则
MYSQL 引擎
MYISAM 表锁 低并发使用 非簇INDEX
INNODB 行锁 高并发使用 簇INDEX
建表:
MYISAM
按获取的值一个个创建,不会进行排序。如 1,aa;13,aa;11,aa 输入,在数据表中为1,aa;13,aa;11,aa三条记录
INNODB
进行排序后创建。如 1,aa;13,aa;11,aa 输入,在数据表中为1,aa;11,aa,13,aa三条记录
原因是什么?非簇INDEX关系
查询
ID是INDEX
MYISAM
select count(*) from xxx; 快
因为是统计量另存一个地方,直接去取值
select * from xxx where id>1; 慢
非簇INDEX关系,索引KEY存放在一个节点,数据放在另一地方,通过指针获取。
select id from xxx where id>1; 快
只读取索引列表
INNODB
select count(*) from xxx; 慢
一行行统计
sleect * from xxx where id>1; 快
簇INDEX关系,索引KEY和数据放在一地方。
select id from xxx where id>1; 慢
一个个去读。
写给自己看,初步理解,有待加强,错误难免。
如何写表名或者字段名是变量的参数查询?
declare @sql varchar(200)
set @sql='select * from ' + @table_name
execute(@sql)
相关文档:
If you set it in the cnf(it may be my.ini file) you will likely need to restart the server. Optionally, that is a dynamic variable and can be SET GLOBAL or SET SESSION from the command line as well.So just do as follows.
mysql>show variables like’max_allowed_packet’;
......
http://www.cnblogs.com/neonlight/archive/2008/08/25/1276178.html
近一段时间,很多部门同事反映在使用mysql的过程出现数据库连接自动断开的问题,我对该问题做了一些实验。
关于mysql自动断开的问题研究结果如下,在mysql中有相关参数设定,当数据库连接空闲一定时间后,服务器就
会断开等待超时的连接:
1、相关参 ......
查询语句:
SELECT 字段名 from 表名.
排序 order by 要排序的字段名 desc :以倒序查询.
limit 从第几个开始 查找多少个 :查找指定个数.
同时查询多个字段用","隔开.
如查询表里面的所有数据在字段名处填"*".
如只想显示某字段的前几位字符可以使用LEFT函数.
SELECT 字段名,LEFT(字段名,位数),字段名 from 表名.
COU ......
MySQL Cluster
is a technology that enables
clustering of in-memory databases in a shared-nothing system. The
shared-nothing architecture allows the system to work with very
inexpensive hardware, and with a minimum of specific requirements
for hardware or software.
......
NDBCLUSTER
(also known as NDB
) is an in-memory
storage engine offering high-availability and data-persistence
features.
The NDBCLUSTER
storage engine can be
configured with a range of failover and load-balancing options,
but it is easiest t ......