Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

prex016's avatar

Best schema for products with variety of attributes

We will have millions of products with variety of attributes in laravel. I am going to make it relation with 4 tables.

Products -> id, name,  description
Attributes -> id, name
Attributes_value => id, name
product_attribute => id, product_id, attribute_id, attribute_value_id

Sample data:

Products
id,     name,          description
1,      T-shirt,    attractive look for men


Attributes
id,     name
1      color
2      size


Attribute_value

id,   name
1       black
2        red
3       yellow
4       medium
5       large


Product_attribute

id    product_id    attribute_id   attribute_value_id

1          1                    1                             1
2          1                    1                             2
3          1                    2                             5

Please let me know, how it is for products listing. Any suggestion is also appreciated.

0 likes
0 replies

Please or to participate in this conversation.