MySQL vs XML for Tagging mechanism

Underribido

New Member
I want to store tags per Media (Image/Sound/Video/Pdf) uploaded by users. And in future I would like to use this tags for searching the media. I am a beginner developer, and I used one way to do this.I made two tables [*]TAG (Tagid,Tagname) [*]Mediatags (Mediaid,Tagid)
  • Media is data uploaded data by user
  • tags are simple words used for searching the media again
For example If I upload an image it will have a mediaid=M1 and I will give it two Tags as Tag1, Tag2. Now\[code\]Table 1} will contain data =http://stackoverflow.com/questions/14537305/> Row1 = T1-Tag1 ; Row2 = T2-Tag2 as schema[Tagid,Tag name]Table 2} will contain data => Row1 = M1-T1 ; Row2 = M1-T2 as schema[Mediaid,Tagid] \[/code\]It will be repeated for each uploads by users. When I have to search perticular tag for example:Searching 'Tag1'. It will find Tag id of Tag1 that is 'T1'It will look up to each meadiid in Mediatags table where tag id is 'T1'Then I will get mediaids of those which has tags as T1=Tag1I am using MySQL for this. Now I have another mechanism in mind,IF I make an XML file for each tag containing all media ids which has that Tag.In this example, there will be 2 XML files TAG1.XML , Tag2.XML and both will contain data M1 It creates two steps while searching.Find the XML file of that tag. And we get all mediaids in that which has used that tag.So here, I will find XML file TAG1.XML and read it. It will give me all those media ids which has used tag M1.I think It can be help full while searching. But it will generate too much XML files! I will sort them in Alphabetical dictionaries.I just want to know,1. How efficient here is to use this XML approach then MySQL?2. Finding data in MySql 2 tables then finding an XML file stored in a fixed directory, which is better?If i used first approach, so many rows will be there in a MySql table where in second approach there will be so man XML files(an XML File will not be heavy but so many XML files will be there!)That is why I am confused what is more preferred appraoch!Please suggest!
 
Back
Top