title: How can I make this SQL query the most effective?
body: <p>I am making a website with a large pool of images added by users.</p>
  
  <p>I want to choose randomly one image out of this pool, and display it to the user, but I want to make sure that this user has never seen this image before.</p>
  
  <p>So i was thinking that: when a user views an image, I make a row INSERT in MYSQL that would say "This USER has watched THIS IMAGE at (TIME)" for every entry.
  But the thing is, since there might be a lot of users and a lot of images, this table can easily grow to tens of thousands of entries quite rapidly.</p>
  
  <p>So alternatively, it might be done like that:
  I was thinking of making a row INSERT for every USER, and in ONE field, I insert an array all id's of images that user has watched.</p>
  
  <p>I can even do that to the array:
  base64_encode(gzcompress(serialize($array)</p>
  
  <p>And then:
  unserialize(gzuncompress(base64_decode($array))</p>
  
  <p>What do you think I should do?
  Is the encoding/decoding functions fast enough, or at least faster than the conventional way i was describing at the beginning of the post?</p>
  
  <p>Is that compression good enough to store large chunks of data into only ONE database field? (imagine if the user has viewed thousands images?)</p>
  
  <p>Thanks a lot</p>