XF 2.2 Rebuild post positions


Well-known member
We installed an add-on that broke the new reply process before it could complete. Because of this, new replies were being inserted, but their xf_post.position column was not correct. The add-on was installed for around 12 hours, so we have several hundred posts that have the wrong position value, and as such, we now have dozens of threads with dozens of post #2s.

I didn't see a rebuild tool to recalculate the position numbers. Is there an efficient query that we can run to recalculate these values without looping through the entirety of the posts table?