1. Skip-External-Locking :
即“跳过外部锁定”,据MySQL开发网站的官方解释,External-locking用于多进程条件下为MyISAM数据表进行锁定。 如果你有多台服务器使用同一个数据库目录(不建议),那么每台服务器都必须开启external locking;
当外部锁定(external-locking)起作用时,每个进程若要访问数据表,则必须等待之前的进程完成操作并解除锁定。由于服务器访问数据表时经常需要等待解锁,因此在单服务器环境下external external locking会让MySQL性能下降。所以在很多Linux发行版的源中,MySQL配置文件中默认使用了skip-external-locking来避免external locking。
当使用了skip-external-locking后,为了使用MyISAMChk检查数据库或者修复、优化表,你必须保证在此过程中MySQL服务器没有使用需要操作的表。如果没有停止服务器,也至少需要先运行mysqladmin flush-tables 。
It is possible to set the Event Scheduler to DISABLED only at server startup. If event_scheduler is ON or OFF,you cannot set it to DISABLED at runtime. Also, if the Event Scheduler is set to DISABLED at startup, you cannot change the value of event_scheduler at runtime.
Starting the MySQL server with the --skip-grant-tables option causes event_scheduler to be set to DISABLED, overriding any other value set either on the command line or in the my.cnf or my.ini file (Bug #26807).
在老版本的MySQL中,此参数的写法为:skip-locking
From MySQL 4.0 on, external locking is disabled by default. (从4.0开始,external locking 被默认disabled)
2. Event Scheduler :
事件调度器是定时触发执行的,在这个角度上也可以称作是;临时的触发器;。触发器只是针对某个表产生的事件执行一些语句,而事件调度器则是在某一个(间隔)时间执行一些语句。事件是由一个特定的线程来管理的,也就是所谓的;事件调度器;。启用事件调度器后,拥有 SUPER 权限的账户执行 SHOW PROCESSLIST 就可以看到这个线程了。通过设定全局变量event_scheduler 的值即可动态的控制事件调度器是否启用。
实验操作:
show variables like 'event_scheduler';+-----------------+-------+| Variable_name | Value |+-----------------+-------+| event_scheduler | OFF |+-----------------+-------+SET GLOBAL event_scheduler = ON;show processlist ;
delimiter //create procedure `Slave_Monitor`()begin
SELECT VARIABLE_VALUE INTO @SLAVE_STATUS FROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME='SLAVE_RUNNING';
IF ('ON' != @SLAVE_STATUS) THENSET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;START SLAVE;END IF;
end; //
CREATE EVENT IF NOT EXISTS `Slave_Monitor`ON SCHEDULE EVERY 5 SECONDON COMPLETION PRESERVEDOCALL Slave_Monitor();show processlist ;
3. innodb_locks_unsafe_for_binlog By default, the value of innodb_locks_unsafe_for_binlog is 0 (disabled), which means that gap locking is enabled: InnoDB uses next-key locks for searches and index scans. To enable the variable, set it to 1. This causes gap locking to be disabled: InnoDB uses only index-record locks for searches and index scans.