views:

21

answers:

2

I imported all of our database to a new server. When I looked at the tables I see the indexes, but they all show a cardinality of 0. If I remove one index and add it back in, it triggers all the other indexes to run, but there's 180 tables. Is there a way to force all the tables to run their indexes?

+1  A: 

You could try mysqlcheck. Your specific requirements may be different, so check the docs, but something along these lines might help:

mysqlcheck -u root -p <dbname> --auto-repair --check --optimize --databases

The --optimize flag is probably the most important in your case. Be sure to note the comments in the first paragraph of the docs about the locks that are placed on tables while this command is running.

Mike
A: 

Try Rebuilding or Repairing Tables or Indexes. It sounds like you basically need to rebuild all your indices.

Kalium