title: Should I use EAV model?
body: <p>I'm am designing my database/domain for an eCommerce application and I'm having a hard time figuring out how to store products.</p>
  
  <p>The website will sell a wide range of products, pens, thongs, tattoos, umbrellas, everything. Each of these product will share a few common attributes, height, width, length, weight, etc but some products have special data. For example, pens have different ink colors and tips/lids and brochures can have different types of folds. So far I have thought up some 20+ extra attributes, but these attributes may only apply to 1% of products on the website.</p>
  
  <p>So I am wondering if it is appropriate to implement a EAV model to handle the extra data. Keeping in mind that when customers are viewing the site in the frontend, there will be a filtering sidebar like on eBay and carsales.com.au. (So keeping in mind there will be a fair bit of querying)</p>
  
  <p>I don't think it's practical to implement Class Table inheritance as the system needs to remain flexible. This is because, down the track we may have more attributes in the future with new types of products.</p>
  
  <p>The other thing I have considered is using a NoSQL database (probably MongoDB) however I have little experience with these types of databases, will it even solve my problem?</p>
  
  <p>Review of options:</p>
  
  <ol>
  <li>Single products entity with lots of columns</li>
  <li>Separate attributes entity (EAV)</li>
  <li>Switch to schema-less persistence </li>
  </ol>
  
  <p>I'm in the process of building a prototype with an attributes entity to see how flexible it is, and testing the performance and how out of control the querying gets.</p>
  
  <p>EDIT: I am, of course, open to any other solutions.</p>