[Tagdb] tags in separate table

Michal Migurski mike at teczno.com
Wed Oct 12 14:44:48 GMT 2005


> I have one question - what is the advantage of having a separate table
> for tags.  Lets assume we agree that we have separate tables for users
> and links, and we have a table for the connection users, links and
> tags.  Then why should I have a separate table for the tags instead of
> using them literally in the table (ie. instead of representing them as
> a foreign key put the whole text of the tag into the field).

It's more efficient and more extensible to search for entities-by-tag  
when tags have their own table. The relationships are fully  
bidirectional that way.

The only way to do this if the tags are stored as a field in an  
entity is to use a pattern match or a full text search, both of which  
are expensive and hard to manage. I've heard that early versions of  
Del.icio.us used the MySQL fulltext approach, encoding each tag with  
base64 to circumvent the stopwords issue. Apparently they switched to  
a tag-table approach, because fulltext searches don't work with  
InnoDB tables. Flickr also used something like this in their  
photos.search method, because for a time it was not possible to  
search for tags of three or fewer letters. This changed sometime in  
the winter or spring, though I don't know what their solution was.

-mike.

------------------------------------------------------
michal migurski- contact info, blog, and pgp key:
sf/ca            http://mike.teczno.com/contact.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://nelson.textdrive.com/pipermail/tagdb/attachments/20051012/911a8d68/attachment.htm


More information about the Tagdb mailing list