Performance of database tag schemas

June 20, 2005

graphPhilipp Keller has done some performance test on 4 different database schemas for storing tagged items. Although his article refers to tagging bookmarks, you can tag pretty much anything.

He tests a one table setup with and without a full text index (tags are just a column in the table), a two table setup (a tag table with a foreign key to the item), and a three table setup (tags, items, and tag item relation table).

I found the results to be somewhat surprising. The full text index is slowest on a small tag set (250 tags) but with (999) tags it was fastest for finding items tagged with two tags.

The three table method was faster than the two table method on all tests except for inserting new rows. The un-normalized one table method is obviously fastest for adding new items. I would guess it would be fastest for update and delete as well.

Note that his tests were done using MySQL, using a different database you might get different results.

Check out his report

Related Entries

4 people found this page useful, what do you think?


Thanks for the "comment"! In fact it would be interesting to test this on different databases.. Postgresql for instance.
Yes that would be interesting, but postgresql doesn't have out of the box support for full text search I don't think.
I just got a comment on postgres ( and benchmarking. The guy says, that he tried postgres and found out that it is slower than mysql.

Post a Comment


Spell Checker by Foundeo

Recent Entries


did you hack my cf?