I updated the plug-in accordingly but want to issue a warning before you download it: I’m not sure which version of MySQL does or does not support ‘left outer joins’. I think versions > 3.23 should be able to do so. If not, you’re out of luck.

(I discussed outer joins here and here)

I am surprised (once again) about the database design in WordPress. Version 2.0 included ‘major changes’, like adding the comment count in the Posts table. If correctly designed (as in true ‘one-to-many’ relationship), you can just fish out the comment count using an outer join without any performance loss (after all, one-to-many relationships depend on identical keys in both tables, which are generally indexed anyways!). Here’s a reminder for people who start to look around the corner, or who are just dipping their toes in SQL: you do not treat a one-to-many relationship as a ‘one-to-one’ relationship. Trust me: you’ll miss out.

This entry was posted in SQL, Wordpress. Bookmark the permalink.