Yii and MySQL EAV databases model

Hello all,

I’m a new user of Yii \0/.

I made a PDM (Physical Data Model) for my database project, this one use an EAV (Entity-Attribute-Value) model, so I would like to know if Yii support EAV database model ?

And if yes where can I find some exemples or tutorials with this kind of database ?


There is an EAV extension but I haven’t checked it out.


Never heard about EAV, but interesting. Is that a concept you have to implement yourself on a existing relational DB (MySQL) or are there DBMS directly supporting this?

If you have to build it yourself (like attribute table user_attributes with fields user_id, name, value) you can easily access these attributes from the main user record. You can define a HAS_MANY relation from user->user_attributes and use the ‘index’ feature of ARR, for convenient access to these dynamic attributes.

Magento uses EAV extensively.


This is my 2 cents opinion :)

Magento uses EAV extensively, but it’s terribly slow. EAV is slow, and in most case you can do same thing (I mean: obtain same recordset result) without using it.

It’s simply an how-you-design-DB problem: Magento uses EAV for everything, and it’s not good for me. I don’t like Magento DB design because of extensive use of EAV pattern.

I’m not saying that EAV is 100% evil, for example for custom product’s options I don’t see anything different from using EAV, but I think it’s a last chance for a DB designer.

I agree that Magento is very slow, it seems overly complicated too, however I think that EAV works well for the product definitions. From a users point of view, it is great to be able to add as many attributes to the product as desired.

If you want to run Magento you need a very capable server. A lot of shared hosting options just don’t cut it.

I never really analyzed the Magento DB so thanks for pointing out that part of the performance hit is in the data access, I always just thought the thing was bloated.


magento is slow cause it preloads everything and processes 100s of xml files… there are many reasons why it’s slow - but i doubt it is the eav model…

every generic shopsystem would require the eav model - cause the product-attributes are too dynamic to be managed by poor programmers

just as a not here - else everybody thinks eav is just slow… eav only means variable object-attributes

btw: some current user-extensions for yii are also using eav for the user-profile

and for googlers like me, the link to the extension: http://www.yiiframework.com/extension/eavbehavior/

EAV on MySQL is slow. I have experience on a Joomla extension module that use EAV to store some of its data. Once the record goes over ten of thousand. Part of that extension just stop working, take a extremely long time for request to come back. Till timeout.

If you are looking for EAV modeling and have load of records, document based database will be better. Take a look at Mango.


some body may be choice serialize the additional attributes to blob ,but in search scenario it will be harder . full text searching? :(

EAV databases are generally slow, and very hard to scale them(on MySql).

Magento is slow for many reason, and one of reason is very complex db structure, and because it is made to be easy customized, so there are thousands of options that need to be parsed(queried).