Hi all,

I understand the usability differences between Active Record and DAO, but need a better understanding of performance in a very large database/high traffic environment.  Assuming the code is optimized in either case, can one assume DAO has less overhead, is faster  and would be more conducive to a high traffic environment?

I'm no expert on the topic, but looking for some advice.



Because AR is built on top of DAO, it is definitely slower than using DAO directly. However, the overhead is expected to be very small, because it is mainly caused by data population. Compared with the cost needed by query execution (often in the scale of 100ms or higher), this overhead (at 10ms or smaller scale) should be negligible.

Thanks Qiang.

A project I'm working on will require full text search.  Instead of trying to write some algorithm to control the details, I'm thinking of using mySQL's full text search feature. 

I would prefer to use AR in the application vs DAO.  I sometimes have difficultly understanding the limitations of AR, so wonder if it would allow mySQL's full text search capabilities using Post::model()->findBySql($sql,$params).



I think it should work (findBySql). But if not, you can always declare a static method in your AR class and call DAO to accomplish your goal. By doing so, all DB-query-related code are placed inside models, which helps organize your code.

OK, thanks Qiang.