Answer the question
In order to leave comments, you need to log in
Yii, EAV, performance?
Goodnight.
Faced such a question. There is some pretty heavy processing of entities on a Yii-based site.
I will briefly describe the essence: there are products that have custom modifications (for example, 8GB and 16GB phones, only the actual parameters can be different + for one product there can be several interrelated parameters and the number of values \u200b\u200bmay differ).
Now there is one variable parameter on the products (on average, each product has 5-7 variations). All this is implemented through EAV.
The problem is that performance is not entirely satisfactory. 1 category page = 17 products, which takes 3.5-3.7 seconds on the server. Profiling the code and queries shows that it takes about 2 seconds to call the type (it is repeated 141 times on one page):
$attribute = Attribute::model()->with('options')->findByAttributes(array('name'=>$attr));
Answer the question
In order to leave comments, you need to log in
are you using this thing? Just throw out and rewrite with inner/left joins for selects.
When working with a database, there should be nothing implicit - you should fully understand how this or the ActiveRecord call works.
I developed a store in Yii, products with variable parameters, parameters in a separate table, a many-to-many relationship - everything ran fine.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question