Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Looking up tags for images in a database

Name: Anonymous 2010-02-06 22:29

I am working on a PHP/MySQL project. One of the things it will do is basically tag images. I have a tag table set up in the database(since tags will need more than just a name field).

My friend is trying to convince me that I should just put all the tag keys that apply to an image into its record on the image table instead of relating them through a middle table.

Basically what he is telling me I should do is like below:

image Table Example:
ID, Image_Path, Tags
1,  yar.jpg, 6 9 3 14

tag Table Example
ID, Tag_Name, Tag_Description
1, Yar, Pirate Sound

And not have a middle relational table. Instead exploding the tags field when I need to process the image entry and looking up the tags.

I am thinking this is more complicated and less efficient than just using a relational table between the image table and tag table.

Is it better to do it his way, should I be using a relational table, or are both of these ideas bad?

Name: Anonymous 2010-02-06 22:52

your friend has never heard of normalisation.
don't listen to him.

Name: 2 2010-02-06 23:01

i suggest you read this, then get him to read it:
http://en.wikipedia.org/wiki/Database_normalization

Name: Anonymous 2010-02-07 0:02

Let me guess, OP. You want a better way to organize your porn.

Yeah, I've been meaning to make something like this as well.

Name: Anonymous 2010-02-07 0:23

>>4
Damn, reminds me I should organize mine as well in a /prog/-worthy way.

Name: Anonymous 2010-02-07 1:46

>>4

Yeah, I've also considered doing this but I can't be arsed. How about OP does it and makes it available to the rest of us?

Name: Anonymous 2010-02-07 10:32

>>5
There is no /prog/-worthier way than storing it in HD on a NAS device and transcoding it down to whatever resolution works best with the connecting device, e.g. 80x25 with a 4-bit color range.

Name: Anonymous 2010-02-07 11:29

Your `friend' is right, relational databases have always sucked horribly for tagging.  Denormalize the tags and use a full-text indexing engine. You could just skip the tag id too, and use the tag name as a natural primary key. And afterwards you should get down on your knees and suck your `friend's dick for putting up with your PHP/MySQL using sorry ass.

Name: Anonymous 2010-02-07 16:52

I am working on a PHP/MySQL project.
Now you have three problems.

Name: Anonymous 2013-01-19 20:59

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Don't change these.
Name: Email:
Entire Thread Thread List