I am very new in Laravel and active records in general. I apologize in advance if this is a stupid question. But I would like to make sure if what I'm thinking is correct.
background:
The laravel docs says in the eloquent ORM section:
Since Eloquent models are query builders, you should review all of the methods available on the query builder. You may use any of these methods in your Eloquent queries.
It has been mention a lot of times that eloquent queries aren't very good options when processing very large data, and it is usually a good idea to use the base query builder instead.
I am wondering about the statement:
You may use any of these methods in your Eloquent queries.
Many examples I have seen separates the two (E.G.
DB::table('table')->get();
usually faster than
model::all()
) in comparing performance.
I am planning to create my new project with Laravel, and am thinking about using both functionalities (the base query builder methods for processing complicated and large data then using specific eloquent methods for anything else).
My question:
I'm thinking of how I can make my code readable, clean, and reasonably efficient. I would be dealing with possibly large data (E.G. thousands to millions of rows and 20 to 30 tables on two databases). Is it safe to say that:
DB::table('table')->get();
is the same as:
MODEL::get();
and assuming that both only return a collection, in large data usually faster than
MODEL::all();
? Thanks.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2v3UnaL
via IFTTT
Aucun commentaire:
Enregistrer un commentaire