?
Solved

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

Posted on 2010-01-12
3
Medium Priority
?
1,424 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
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…

800 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