Tag Soup

I’ve really struggled with the challenge of implementing tags efficiently. Basically, I wanted to preserve the basic tag rule: as many tags as you like per post. But if I do that, I need another table in the database. However, to do this, I need an additional query for each story. Since Small Axe loads in just FOUR queries on the main page, this was a HUGE hit. It went up to 24 queries, albeit 24 simple, basic, efficient, FAST queries.

So I wrote it to use a single query, and guess what I found? The implementation sucked. It was slow. It was dirty. It meant editing tags was a precise business. And searching was lame. So, I rewrote tagging (while preserving links, etc) and – boom! – fast. Yes, it added a query for every story on the front page, but dammit, it works, it’s clean, it’s easy to read, and best of all, I’m going to implement some flickr-style tag editing on the backend. So, that’s cool.

I guess we’ll see what happens in the next week or two.