So I have an image gallery website organized in albums and so the db table storing images of the albums, has this scheme basically:
album_id | images_link
112 | 1.jpg
112 | 2.jpg
112 | 3.jpg
112 | 4.jpg
112 | 5.jpg
112 | 6.jpg
112 | 7.jpg
112 | 8.jpg
112 | 9.jpg
So in order to avoid a super-long database table I'm thinking maybe to store all the images of the albums to a single cell like so:
album_id | images_link
112 | 1.jpg, 2.jpg, 3.jpg, 4.jpg, 5.jpg, 6.jpg, 7.jpg, 8.jpg, 9.jpg
I mean the database size of course will remain the same but there will be significantly less rows to read. I'm going to use the explode function to split and serve each image file link. Is this a smart choice? I'm not sure if the explode function is memory as hungry as fetching a large database. I'd like to hear your opinion.
See the problem is the images names are not that short, images_link row is set to 27 chars so with a limit of 30 pictures per album that I have set, so a single cell is expected to reach 810chars to a later time. I've never used varchar to store that amount of bytes, is it better to use VARCHAR in this case or TEXT ? I know VARCHAR is faster.
Thank you in advance.