Fast/efficient approach:
-- execute("UPDATE posts SET comments_count = (SELECT count(1) FROM comments WHERE comments.post_id = posts.id)")
-> 1.3197s
Slow/naïve approach:
-- Seeding posts.comments_count -- Better grab a coffee.
-> ...........................
-> 144.7302s
-> 26900 rows
This is great! Will have to read up on my raw SQL to fully understand, but certainly faster.