Question

I've created a custom product attribute of type text.

When viewing the catalog_product_entity_varchar table, I'm slowly but surely noticing these records being inserted into that table (if I save new products, edit & save existing products etc.).

My question is this:

Why has Magento not created NULL values for all products in my catalog for this attribute? I did choose to Used in Product Listing = Yes.

Was it helpful?

Solution

When adding a new attribute (and attaching it to attribute sets) the products that already existed prior to adding it do not have values for that attribute.
It would be kind of useless and a performance killer (and magento does not need an other performance killer).
Here is a scenario.
Let's say you have 10k products in your store. And you add one new attribute for all the attribute sets.
If your expectation was right then you will have 10k new lines in a table that you don't need. Not to mention that it will take a while to insert them when you create the attribute.
If you later decide to use that attribute only for 3 products you remain with 9997 useless lines.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top