How to repair the table? And which query to execute?

And do you mean "Resynchronise post counts" in the ACP?