Ask a Question
Advertise on boostr.in
Organizational Research By
Surprising Reserch Topic
best practice for storing tags in a database using -'mysql,performance,optimization,tags,structure'
best practice for storing tags in a database ¬†using -'mysql,performance,optimization,tags,structure'
I developed a site that uses tags (key words) in order to categorize photographs.
Right now, what I have in my mysql database is a table with the following structure:
Every time someone tags an image (if the tag is valid and has enough votes) it's added to the database. I think that this isn't the optimal way of doing things since now that I have ¬†5000+ images with tags, the tags table has over 40000 entries. I fear that this will begin to affect performance (if it's not already affecting it).
I considered this other structure thinking that it'd be faster to fetch the tags associated to a particular image but then it looks horrible for when I want to get all the tags, or the most popular one for instance:
tags ¬†¬†¬†¬†(text) //comma delimited list of tags for the image
Is there a correct way of doing this or are both ways more or less the same?
Thanks in advance for all your support
Sep 7, 2015
to add a comment.
Related Hot Questions
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please