Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7036511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:25:59+00:00 2026-05-28T01:25:59+00:00

I have a database used for statistics, with over 2000 tables, each with ~100

  • 0

I have a database used for statistics, with over 2000 tables, each with ~100 millions rows.

I think a few times a week it’d be nice to check the tables to make sure they are healthy, and if not, repair and optimize them.

60% of the tables are updated everyday, and the rest are archives.

My question is about check(repair)/optimize: Is it good to check table health and optimize them a few times a week to make sure the system runs smoothly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:25:59+00:00Added an answer on May 28, 2026 at 1:25 am

    Generally you need to OPTIMIZE table when its datafile is too much fragmented on disk (use tools for your filesystem to check – the script linked by GiantRobot is not calculating fragmentation), when there were many rows updated and changed their size (that would create row fragmentation) or after deleting many records when you won’t be adding them again soon. Because free space is used by MySQL for new rows, when the deleted and new records have the same row size, no OPTIMIZE is needed.

    CHECK TABLE is used only when you suspect data corruption (which should not occur during normal run). Some linux distributions (Debian for example) have startup scripts which run CHECK TABLE for all tables on MySQL server startup. REPAIR TABLE is then used to repair the corrupted tables.

    ANALYZE TABLE can be used to update index cardinality, which is used in determining the query execution plan. Usually it is needed only in special cases.

    It is not clear from your question how are your statistics tables used… how many writes, deletes and reads? My statistic tables have writes all the time, and once a day it is read, data consolidated and written to other table, then deleted. In such case, there is no need to run OPTIMIZE as data are not read often and free space is reused for new data. I am using partitioning by day, so instead of deleting the records (which is quite slow) I just DROP PARTITION (which takes 1 sec max.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an sqlite database used to store information about backup jobs. Each run,
I have a table with about 100.000 rows that used to look more or
I have a database that I used specifically for logging actions of users. The
I have a column in my SQL-2005 database that used to be a varchar(max)
I have a 'reference' SQL Server 2005 database that is used as our global
In one of my applications I have a 1gb database table that is used
I have a number of scripts used to build a database. These need to
I used to have a situation where I hit the database a every time
I have used code like this: http://msdn.microsoft.com/en-us/library/dw70f090.aspx to access database before when working in
I have a TSQL script that is used to set up a database as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.