title: When should database indexes be rebuilt?
body: <p>I was reading about refactoring a large slow SQL Query over <a href="https://stackoverflow.com/questions/320919/refactoring-extreme-sql-queries">here</a>, and the current highest response is from Mitch Wheat, who wants to make sure the query uses indexes for the major selects, and mentions:</p>
  
  <blockquote>
    <p>First thing I would do is check to make sure there is an active index maintenance job being run periodically. If not, get all existing indexs rebuilt or if not possible at least get statistics updated.</p>
  </blockquote>
  
  <p>I'm only am amateur DBA, and I've made a few programs freelance that are basically Java desktop clients and occasionally a MySQL backend.  When I set up the system, I know to create an index on the columns that will be queried by, there's a varchar CaseID and a varchar CustName.</p>
  
  <p>However, I set this system up months ago and left the client operating it, and I believe the indexes should grow as data is entered and I believe everything is still working nicely.  I'm worried though that the indexes should be rebuilt periodically, because today i have read that there should be an 'active maintenance job'.  The only maintenance job I set on the thing was a nightly backup.</p>
  
  <p>I wanted to ask the community about regular maintenance that a database might require.  Is it neccessary to rebuild indexes? Can I trust the MySQL backend to keep going so long as no one messes with it and the data stays under a few gigabytes?</p>