Database Administration Statements
MySQL 5.5 Reference Manual / SQL Statement Syntax / Database Administration Statements / Table Maintenance Statements
optimize table 优化表
mysql> ? optimize table
Name: 'OPTIMIZE TABLE'
Description:
Syntax:
OPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name [, tbl_name] ...
NO_WRITE_TO_BINLOG 抑制sql语句被写入到binlog
Reorganizes the physical storage of table data and associated index data, to reduce storage space and improve I/O efficiency when accessing the table. The exact changes made to each table depend on the storage engine used by that table.
重新组织表数据和相关索引数据的物理存储,减少存储空间、提升访问表时的I/O效率,对每张表的确切的改变取决于该表使用的存储引擎。
Use OPTIMIZE TABLE in these cases, depending on the type of table:
在这些场景下优化表,取决于表类型:
o After doing substantial insert, update, or delete operations on an InnoDB table that has its own .ibd file because it was created with the innodb_file_per_table option enabled. The table and indexes are reorganized, and disk space can be reclaimed for use by the operating
system.
o 在一张有自己的.ibd文件的InnoDB表(创建时启用innodb_file_per_table选项)执行了大量的插入、更新或删除操作之后,通过执行optimize table,这个表会被重新组织,磁盘空间可以被操作系统再次使用。(聚簇索引)
o After deleting a large part of a MyISAM or ARCHIVE table, or making many changes to a MyISAM or ARCHIVE table with variable-length rows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT columns). Deleted rows are maintained in a linked list and subsequent INSERT operations reuse old row positions. You can use OPTIMIZE TABLE to reclaim the unused space and to defragment the data file. After extensive changes to a table, this statement may also improve performance of statements that use the table, sometimes significantly.
o 在删除了一个MyISAM或ARCHIVE表的一大部分、或对包含可变长度行的MyISAM ARCHIVE表(包含VARCHAR VARBINARY BLOB TEXT列的表)做了很多改变,被删除的行通过一个linked list来维护,随后的插入操作重新使用旧的行位置。你可以使用OPTIMIZE TABLE 来收回未使用的空间、对数据文件碎片整理。在大量的改变之后,这个语句也可以显著提升使用这张表的语句的性能。
This statement requires SELECT and INSERT privileges for the table.
这个语句要求具有对该表的select和insert权限。
OPTIMIZE TABLE is also supported for partitioned tables. For information about using this statement with partitioned tables and table partitions, see
http://dev.mysql.com/doc/refman/5.5/en/partitioning-maintenance.html.
URL: http://dev.mysql.com/doc/refman/5.5/en/optimize-table.html
OPTIMIZE TABLE 也支持分区表。
Kill Statements 停止SQL或连接
mysql> ? kill
Name: 'KILL'
Description:
Syntax:
KILL [CONNECTION | QUERY] processlist_id
Each connection to mysqld runs in a separate thread. You can kill a thread with the KILL processlist_id statement.
每个到mysqld服务的连接都运行在分离的线程。你可以使用kill processlist_id 语句杀死一个线程。
Thread processlist identifiers can be determined from the ID column of the INFORMATION_SCHEMA.PROCESSLIST table, the Id column of SHOW
PROCESSLIST output, and the PROCESSLIST_ID column of the Performance Schema threads table. The value for the current thread is returned by the CONNECTION_ID() function.
线程识别符可以从INFORMATION_SCHEMA.PROCESSLIST的ID列、show processlist的输出、Performance Schema的threads表的PROCESSLIST_ID得到。当前线程的ID可以从 select connection_id()得到。
KILL permits an optional CONNECTION or QUERY modifier:
kill 允许 CONNECTION 和 QUERY 这两个可选的修饰符
o KILL CONNECTION is the same as KILL with no modifier: It terminates the connection associated with the given processlist_id, after terminating any statement the connection is executing.
Kill CONNECTION 等同于 Kill 不加修饰符:它终止了语句之后,又终止了连接。
o KILL QUERY terminates the statement the connection is currently executing, but leaves the connection itself intact.
Kill QUERY 终止了正在执行的语句,但保留了连接本身。
If you have the PROCESS privilege, you can see all threads. If you have the SUPER privilege, you can kill all threads and statements. Otherwise, you can see and kill only your own threads and statements.
如果你有process权限,你可以看到所有线程。如果你有super权限,你可以杀死所有线程和语句。否则,你只可以看到和杀死自己的线程和语句。
You can also use the mysqladmin processlist and mysqladmin kill commands to examine and kill threads.
你也可以使用mysqladmin processlist 和 mysqladmin kill 来检测和杀死线程。
*Note*: You cannot use KILL with the Embedded MySQL Server library because the embedded server merely runs inside the threads of the host application. It does not create any connection threads of its own.
你不可以将kill语句用在嵌入式Mysql服务,因为嵌入式服务只运行在主机应用的线程中,本身并没有创建任何连接线程。
URL: http://dev.mysql.com/doc/refman/5.5/en/kill.html
Database Administration Statements的更多相关文章
- Mysql手册—SQLStatementSyntax
14.1.1 ALTER DATABASE Syntax,可用于修改数据库字符集和校验规则 查看校验规则可如下: 由于utf8的校验规则都是ci(case insensitive),所以是不区分大小写 ...
- SHOW Syntax
MySQL 5.5 Reference Manual / SQL Statement Syntax / Database Administration Statements / SHOW ...
- P6 EPPM Manual Installation Guide (Oracle Database)
P6 EPPM Manual Installation Guide (Oracle Database) P6 EPPM Manual Installation Guide (Oracle Databa ...
- P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1
P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1 May ...
- [Windows Azure] Getting Started with Windows Azure SQL Database
In this tutorial you will learn the fundamentals of Windows Azure SQL Database administration using ...
- [Windows Azure] How to Deploy a Database to Windows Azure
How to Deploy a Database to Windows Azure There are several different ways you can move an on-premis ...
- [Windows Azure] Guidelines for Connecting to Windows Azure SQL Database
Guidelines for Connecting to Windows Azure SQL Database 6 out of 12 rated this helpful - Rate this t ...
- Oracle Tuning 基础概述01 - Oracle 常见等待事件
对Oracle数据库整体性能的优化,首先要关注的是在有性能问题时数据库排名前几位等待事件是哪些.Oracle等待事件众多,随着版本的升级,数量还在不断增加,可以通过v$event_name查到当前数据 ...
- P6 EPPM Installation and Configuration Guide 16 R1 April 2016
P6 EPPM Installation and Configuration Guide 16 R1 April 2016 Contents About Installing and ...
随机推荐
- Eureka 参数调优
常见问题 为什么服务下线了,Eureka Server 接口返回的信息还会存在. 为什么服务上线了,Eureka Client 不能及时获取到. 为什么有时候会出现如下提示: EMERGENCY! E ...
- Html 标签初知
Html 标签初知 什么是Html 标签 超文本标记语言(外国语简称:HTML)标记标签通常被称为HTML标签,HTML标签是HTML语言中最基本的单位,HTML标签是HTML(标准通用标记语言下的一 ...
- this指向问题,只提供案例,不做任何分析
希望大家在测试的道路上找到答案,阔步前行 <script type="text/javascript"> /*this指向 console.log(this); fun ...
- 批处理学习之Bat命令——获取当前盘符、当前目录、上级目录
命令 当前盘符:%~d0 当前路径:%cd% 当前执行命令行:%0 当前bat文件路径:%~dp0 当前bat文件短路径:%~sdp0 测试 下载testBatPath.bat测试文件,双击.bat运 ...
- JavaScript自定义求和函数
我爱撸码,撸码使我感到快乐!大家好,我是Counter,当看到这个标题到时候是不是感觉很简单,千万不要大意哦,你说0.1 + 0.2 = 0.3 ?有时候计算机并不是我们所说绝对精确,这个时候就要我们 ...
- HTML基础【4】:表格标签
表格标签 在过去表格标签用的非常非常的多,绝大多数的网站都是使用表格标签来制作的,也就是说表格标签是一个时代的代表 作用:以表格形式将数据显示出来,当数据量非常大的时候,表格这种展现形式被认为是最为清 ...
- 洛谷 P1273 【有线电视网】
题目描述 某收费有线电视网计划转播一场重要的足球比赛.他们的转播网和用户终端构成一棵树状结构,这棵树的根结点位于足球比赛的现场,树叶为各个用户终端,其他中转站为该树的内部节点. 从转播站到转播站以及从 ...
- 洛谷 P2915 【[USACO08NOV]奶牛混合起来Mixed Up Cows】
类似于n皇后的思想,只要把dfs表示放置情况的数字压缩成一个整数,就能实现记忆化搜索了. 一些有关集合的操作: {i}在集合S内:S&(1<<i)==1: 将{i}加入集合S:S= ...
- Spring中 @Autowired标签与 @Resource标签
spring不但支持自己定义的@Autowired注解,还支持由JSR-250规范定义的几个注解,如:@Resource. @PostConstruct及@PreDestroy. @Autowired ...
- Java项目中使用log记录日志的一些总结
本文介绍了一下自己在Java项目中使用log的一些总结,从日志的作用.日志的选用.日志级别介绍.日志记录的一些最佳实践几个方面阐述. 日志的作用 主要作用包括: 1.出问题后定位当时问题 2.显示程序 ...