Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

In MySQL, is there a way to compute table statistics?

Posted on 2010-01-12
3
Medium Priority
?
1,505 Views
Last Modified: 2012-05-08
We are experiencing some very slow queries in MySQL on tables which have frequent updates. Is there a way, like the Postgres "vacuum full analyze", to compute all table statistics in a particular database so that the query optimizer can find a better execution path?
0
Comment
Question by:nirvanastorage
  • 2
3 Comments
 
LVL 7

Expert Comment

by:db2inst1
ID: 26299059
ANALYZE table command will do that for you. But be sure to read about the locks it would hold on the table engine_type you have.

http://dev.mysql.com/doc/refman/5.0/en/analyze-table.html

I don't think there is a single command for the whole database. But you can achieve it with a quick script.
0
 
LVL 7

Accepted Solution

by:
db2inst1 earned 2000 total points
ID: 26299075
Actually you can use mysqlcheck --all-dataabases for all the tables in all the database in MySQL

http://dev.mysql.com/doc/refman/5.0/en/mysqlcheck.html
0
 

Author Closing Comment

by:nirvanastorage
ID: 31676317
you're a genius
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question