May 13, 2009

Number of rows in InnoDB table

Since "select count(*) from table_name" may be extremely heavy operation for huge InnoDB tables, you may execute EXPLAIN to get approximate number of rows.

EXPLAIN select count(*) from table_name;

This will work also for checking how many rows matching to some condition if covering index exists:

EXPLAIN select count(*) from table_name where index_column = v;

No comments:

Post a Comment