php - Optimization dilema -


my doubt of optimized. i'm building kind of "social network". users can upload: photo almbums, files or messages. each 1 of data saved in different table. receivers saved userid sepparated comma, such :"1,2,3,4," . want grab sent user. have 2 ways (that know of) so.

  1. fetch each table separatedly(not efficient since i'll have query each row fetched de senders user table).and proccess data.

  2. join 3 tables. understand cant use in join.

any ideas?

ps: im doing in php , mysql

you can use in join (see how use join in sql?), if understand properly, shouldn't represent receivers comma-separated string list. instead, use table separate record every receiver-item relationship, can query on without needing use like.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -