About optimize table

Hi,

I know how to use the optimize command for a table but when it is executing, why it creates a temp table?

if i have a table with 50000000 or rows, it is a good practice to use it?

using alter table, can i rebuild a table and update table statistics? How can i use it?

Thanks for your help.

http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html

For InnoDB tables, OPTIMIZE TABLE is mapped to ALTER TABLE, which rebuilds the table to update index statistics and free unused space in the clustered index.

Index statistics can be updated with analyze table also.