title: 'Autosuggestion' feature implementation for a webapp
body: <p>I'm developing a web application and have two models (among others) - users and items with many-to-many association. So I have have tables 'users', 'items' and 'items_users' with primary key 'id' and foreign keys user_id and item_id.</p>
  
  <p>What I'm going to have is an 'autosuggestion' feature. If, say, I'm as a user mark a certain item as good, the system is supposed to suggest n items I most probably would also mark as good. The reasonable criteria for autosuggestion is how many users who liked the first item like another one. If all users who like tea also like a teapot - then the teapot is in top position for autosuggestion.</p>
  
  <p>This is basic functionality, I'll also filter some results but the rest doesn't matter. I'm thinking about some kind of an auxiliary table for fast calculation on demand or scheduling a separate process to calculate n suggestions.</p>
  
  <p>Thank you for any related information!</p>
  
  <p><strong>UPD</strong></p>
  
  <p>The question sounded unclear. I have sql db and sinatra with sequel orm. I'm asking about how to calculate most similar items dataset (cheapest, least resourse consuming approach). How would you implement it?</p>