AuthorityBase is an IT knowledgebase dedicated to the world of databses and RDBMS systems by David Yahalom. Here you'll find articles, tips and general knowledge about Oracle, DB2 LUW, Sql Server, MySql and more. I hope you'll enjoy your stay.
2nd
APR
MySQL InnoDB statistics gathering (analyze table)
Posted by David Yahalom under MySQL
I’ve seen many MySQL DBAs completely unaware of the fact that like most modern RDBMS systems, MySQL also relies on using statistics for keeping track of data distribution in tables and for optimizing join statements.
The syntax for analyzing a table for statistics is very simple:
ANALYZE [LOCAL | NO_WRITE_TO_BINLOG] TABLE <em class="replaceable"><code>tbl_name</code></em> [, <em class="replaceable"><code>tbl_name</code></em>] ...
- You must hold insert and select privileges on the table you want to analyze.
- On MyISM tables this will result in a READ LOCK on the table.
- On InnoDB tables this will result in a WRITE LOCK on the table.
Analyzing data distribution in tables is relevant to both MyISM and InnoDB tables.
The equivalent to the above command is using:
myisamchk --analyze
…on MyISM tables and
mysqlcheck -Aa -uroot -p
or
mysqlcheck --analyze --all-databases<strong>
..on InnoDB tables.
One more thing, keep in mind that unlike myisamchk, mysqlcheck can run online while the database is open.
Recent Posts
- Hashing strings in Oracle 8i,9i,10g
- Started a new job!
- Migrating from SPARC to x86
- Show full process name / path / string in Solaris using ps
- Limelight
Categories
- DB2 LUW (11)
- ETL (2)
- General IT (5)
- Hardware (3)
- Linux (3)
- MySQL (1)
- Oracle (27)
- RAC (3)
- Security (3)
- Solaris (3)
- SQL Server (1)
- Uncategorized (1)
- Unix (2)
- Windows (1)
Archives
- November 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- October 2007
- September 2007
- July 2007
- June 2007
- April 2007
- March 2007
- February 2007
- January 2007
- March 2006
Blogroll
AuthorityBase by David Yahalom is powered by Wordpress. Designed by Free WordPress Themes.
