
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What is the use of OPTIMIZE TABLE statement in maintaining the MySQL tables?
While working with the database, we have a tendency to do plenty of changes like insert, update and delete data within the table which will cause the physical storage of the table fragment. As a result, the performance of database server is degraded.
MySQL provides us with OPTIMIZE TABLE statement that allows you to optimize the table to avoid this defragmenting problem. Its syntax would be as follows −
OPTIMIZE TABLE table_name
Here, table_name is the name of the table.
Example
We are running this statement for the table Student_info as follows −
mysql> Optimize table student_info\G *************************** 1. row *************************** Table: query.student_info Op: optimize Msg_type: status Msg_text: OK 1 row in set (1.34 sec)
- Related Articles
- What is the use of CHECK TABLE statement in maintaining the MySQL tables?
- How ANALYZE TABLE statement helps in maintaining the MySQL tables?
- What is the use of FLUSH PRIVILEGES statement in MySQL?
- What is the use of MySQL IGNORE INSERT statement?
- Using CREATE TABLE AS statement with UNION of two tables in MySQL
- How to use ALTER TABLE statement for changing the size of a column in MySQL?
- What is the use of the WITH statement in Python?
- What is the use of import statement in Python?
- What is the use of "assert" statement in Python?
- What is the use of ‘Using’ statement in C#?
- What is the use of "from...import" Statement in Python?
- What is the use of "from...import *" Statement in Python?
- How to optimize many SELECTs in a single table in MySQL?
- What is the default sort order in MySQL tables?
- How to optimize a MySQL table after deleting some rows?

Advertisements