innodb_max_dirty_pages_pct与检查点的关系 8 days ago Read More
数据库运行一段时间后,经常导致服务器大量的swap,我怀疑是innodb中的脏数据太多了,因为没有free space了,mysql通知OS,把一些脏页交换出去,以上只是猜测。有一个现象是每次关数据库时都要关很久,并且在关数据库时,发现有大量的swap in。如果是数据库进程异常关闭,打开数据库又会花很长的时间来作恢复。我想提高一下mysql检查点发生的频率。看了Adaptive chec...
MySQL内存引擎在体系架构设计中的应用 9 days ago Read More
mysql其中一种存储引擎是memory engine,这种存储引擎的特点是,所有的数据都保存在内存中,读写操作都特别的快。我们通常利用这种存储引擎来保存一些不变的小表数据,充当查询缓存一样。如果现在有一个系统,想每秒支持10000或者更多的插入,我们如何设计这样的系统?除了分库,我们是否想想其它的方法,下面的体系结构也许对大家有所启发:此结构的主要思想是用mysql的memory engi...
Mysqlcft中文全文索引插件 9 days ago Read More
MySQL在高并发连接、数据库记录数较多的情况下,SELECT ... WHERE ... LIKE '%...%'的全文搜索方式不仅效率差,而且以通配符%开头作查询时,使用不到索引,需要全表扫描,对数据库的压力也很大。MySQL针对这一问题提供了一种全文索引解决方案,这不仅仅提高了性能和效率(因为MySQL对这些字段做了索引来优化搜索),而且实现了更高质量的搜索。但是,至今为止,MySQL...
clustered index & secondary indexes 31 days ago Read More
Every InnoDB table has a special index called the clustered index where the data for the rows is stored. If you define a PRIMARY KEY on your table, the index of the primary key is the clustered ind...
mysql Replication 原理分析 31 days ago Read More
mysql经过几个版本的发展,Replication的稳定性也越来越高,性能也得到了长足的发展。当建立起master-slave主从复制关系时,在slave端,会创建两个线程:Slave IO thread 和 Slave SQL thread. 这两个线程有各自的功能和作用。
Slave IO thread : 这个线程与master交互,当master产生新的日志时,向master发出...
MySQL排序原理分析 31 days ago Read More
下面是介绍mysql如何排序的一篇文章:
How MySQL Does Sorting (filesort)
MySQL has two filesort algorithms for sorting and retrieving results. The original method uses only the ORDER BY columns. The modified method...
如何在mysql的slave上作备份 40 days ago Read More
If you are making your dumps from the slave server, it probaly that youdon't have any "master information". To resync one master with one slave youhave to make the dump from the master with the --m...
数据库系统排序优化 40 days ago Read More
不管是ORACLE,还是MYSQL,如果一条SQL单次排序量过大,并且执行频率较高,那么很有可能会消耗数据库系统大量的CPU资源。近期对淘宝的画报系统mysql进行了一次排序优化。整个系统负载一直在4左右,但前几天,运营推广画报,致使PV量迅速上升,load上升到15.这条SQL单次排序量只有20左右,但执行次数的上升,使得服务器用户CPU消耗非常高。
通过show innodb sta...
Truncate table tablename reuse storage故障案例 40 days ago Read More
下面举一个今天发生的案例:
收到报警,一台DB负载升高,问题发现与定位:
使用topas发现用户CPU消耗奇高,再查看当前正在执行的SQL,发现有如下的SQL比较可疑:
bbb(1918,1669) ospid=1082062 hash=1709818753 program=java@i6.cmn (TNS V1-V3) et=8
-
select t.level2 as value f...
自己制造memory leak 59 days ago Read More
为了测试一些东西,需要在数据库服务器上制造点交换,达到类似于hung的效果。于是用c写了一小段程序来实现此功能:
[root@db ~]# cat mem_leak.c#include stdio.h#include string.h
int mem_leak(){ char *p=(char *)malloc(sizeof(char)*100000); if(p == NULL) ...