Welcome Guest, Not a member yet? Register   Sign In
general query questions
#1

[eluser]bigtimslim[/eluser]
I'm pretty new to CI and have been lazy using databases. I typically use active record and will sometimes request all columns via a generic function when I only need a few. How costly is this? Also, I feel like I read something on the forum about active record being slow. I'm very comfortable writing sql. Should I scrap active record and write all my queries out?
#2

[eluser]Sumon[/eluser]
If you are lazy like me Wink
try to habituate yourself with
Code:
$this->db->select('title')->from('mytable')->where('id', $id)->limit(10, 20);
$query = $this->db->get();
#3

[eluser]manilodisan[/eluser]
@Sumon That's only available with PHP5 if I'm not wrong.
#4

[eluser]xwero[/eluser]
It's a good practice to only query the database for the things you need. The more data gets put in the memory the faster the memory limit will be exceeded.

The AR library is slow because it generates the query for you. It's the same thing with everything you let php generate for you. So it's up to you whether you are going to use AR or not.
#5

[eluser]bigtimslim[/eluser]
Thanks for the replies.




Theme © iAndrew 2016 - Forum software by © MyBB