ActiveRecord model of mysql's view is slow

Dear All,

I am developing warehouse application. I utilize mysql’s view based on the transaction rather than maintaining several tables. For example, the item in transaction will appear on some views related to purchase_requisition and stock_item.

The beauty of CActiveRecord is that I can use view instead of table, by just set the primary key. However, when the data is growing up, it is very slow to access the CGridView based on this CActiveRecord?

Is that the expected result? or am I doing wrong? Should I stick with several tables solutions? Any better suggestion on this?

TIA.

Daniel

Maybe you should use eager loading instead of lazy loading.

http://www.yiiframework.com/doc/guide/1.1/en/database.arr#performing-relational-query