Welcome Guest, Not a member yet? Register   Sign In
Active Record or not ?
#2

[eluser]WanWizard[/eluser]
It depends.

In general, a query is a query, it doesn't really matter how you construct it. Using AR, in absolute figures, is always going to be slower than coding it yourself, due to the object overhead.
But I think the discussion is pointless. Hardware is cheap. From the money I have to pay a highly experienced PHP coder to fix bugs in spaghetti code, or to make modifications into hardcoded queries, I can buy plenty of servers. And don't forget you have to do all the prefixing and escaping by hand.

In terms of memory, there is a different story. The standard CI code loads the entire result set into memory when you fetch the results. This can be quite a problem if the result is large. As most databases have the option to seek in the result set, we use a modified DB_result class that checks if the driver used supports seeks, and if so, doesn't load the entire resultset into memory but uses seek calls to fetch next and previous rows. You will still have the problem when you call result_array(), as that has to fetch all records.


Messages In This Thread
Active Record or not ? - by El Forum - 07-28-2010, 01:17 PM
Active Record or not ? - by El Forum - 07-28-2010, 02:59 PM
Active Record or not ? - by El Forum - 07-28-2010, 11:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB