Is the difference between Active Record and queries that big?

Hello guys!

Could you please give me more information about the performance of Active Record versus the performance of queries.

I've decided to develop less used modules of the application with Active record, for instance news system, registration(it doesn't perform a lot of queries).

I would like to understand whether it would be better to use queries for more used modules, like list things, for example offer profiles, etc.

Active Record is so easy to use, you just CRUD and the only thing that remains is to remove unnecessary fields from the form and perform additional filters and so on, but isn't it a performance eater?


The implementation of AR in Yii is very efficient. The main overhead lies in generating the SQL statements and populating data into AR objects, which is minimized as much as possible. Overall, the benefit of using AR far exceeds the performance degradation. Notice also that using AR also makes your code less subject to SQL injection attacks.

I suggest you use AR if possible. Do not worry about performance. If performance becomes a concern, there are many ways to improve it.

Thank you Qiang,

I considered the situation the same way and will try to develop the application this way.