when I use Eloquent to get data, and found out some performance issue
In my case, I use laravel debugbar ( https://github.com/barryvdh/laravel-debugbar ) to collect the information I need.
when I use ORM to get about 20 entries from my DB
$projects = Project::where('status', '=', 2)->get();
it took about 24MB memory usage and 250ms
but when I use the query builder as below
$projects = DB::table('Project')->where('status','=',2)->get();
the database queries and the return data are almost the same, but query builder took only 11MB memory usage and 113ms to get the data.
when the entries I need are about 200 entries, and even relate to other tables via ORM, it take almost 8000ms... and get the "Allowed memory size exhausted" error message very often..
So, I was wondering, in my condition, should I use the query builder and join other table?
Or what should I do to speed up the Eloquent performance ?