3 ms·
Avoiding the EAV model while still being flexible (e.g. sparse attributes for any variety of products) is one place where the JSON datatype really shines. Throw
by meritt 8y ago
Avoiding the EAV model while still being flexible (e.g. sparse attributes for any variety of products) is one place where the JSON datatype really shines. Throw your non-standard attributes into a JSON object and use the native DB functions to filter accordingly. In Postgres and MySQL 8 you can add conditional/functional/virtual indexes to keep things speedy. Maybe Magento will one day take advantage of these features.
It's basically a modern-day approach to Serialized LOB: https://martinfowler.com/eaaCatalog/serializedLOB.html https://martinfowler.com/eaaCatalog/serializedLOB.html
- jimnotgym 8y agoThat is great advice. Where you are talking about just allowing multiple attributes for a product catalogue you can also do 'EAV light' and have a 'user-defined-attribute' table that goes Sku, attribute_id, value and another table with a simple list of attributes. I have seen this in production (not in Magento) for a product catalogue and performance was satisfactory, queries were fairly simple and maintenance was easy. I think I prefer your JSON solution but this keeps very much in line with standard relational thinking.