Database Administration Statements

Posted ChaseForFuture

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Database Administration Statements相关的知识,希望对你有一定的参考价值。

mysql 5.5 Reference Manual  /  

 

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 也支持分区表。

以上是关于Database Administration Statements的主要内容,如果未能解决你的问题,请参考以下文章

ZooKeeper Administrator's Guide A Guide to Deployment and Administration(吃别人嚼过的馍没意思,直接看官网资料)(代码

administration和management有啥区别?

如何引用 Microsoft.Web.Administration?

使用 Microsoft.Web.Administration 后无法启动 IIS Express Web 服务器

Joomla 3.8 Administration - 直接链接到启用/禁用模块

django administration 小记