Just curious what optimizing tables actually does.

We're running 6.4.1. I optimized 2 days ago, our forums were dead today (100+ sec load times), so I optimized tables and the forums are flying again.