views:

178

answers:

2

I’m coding an application with server resources in mind, so I don’t want to use too much so that this application scales in the future. I don’t mind writing my own queries. So, is ActiveRecord resource intensive for my application? Or does it not make a difference?

Thanks!

+4  A: 

CI's ActiveRecord is basically not an ActiveRecord, but a Query Builder. It allows you to form simple queries in an object oriented manner. Like with any abstraction, assembling from object state into a SQL query is slower than hardcoding it, but I suspect the performance impact to be negligible.

Gordon
A: 
  • For the basics website(blog) I think CI active records are fine. I think it is always important to have a good database schema(normalize tables).
  • I believe you could view debug information. You should look at the SQL query the module creates and look at the time spent executing query. It is always important to profile your queries. Don't just make assumptions.
  • I think it is more important to have opcode-cache and cache your sql-queries in memory in for example apc/memcached/redis if possible.
Alfred