Eloquent vs Query Builder vs SQL: Performance Test

  Рет қаралды 49,594

Laravel Daily

Laravel Daily

5 жыл бұрын

One video from my 4-hour course "Eloquent: Expert Level".
Purchase full course here: bit.ly/eloquent-course

Пікірлер: 53
@LoliPeeSlurper
@LoliPeeSlurper 4 жыл бұрын
So Query Builder is a combination of both the advantages of Eloquent (Simplicity and Security) and Raw SQL (Performance). Thanks a lot for your video!
@JoshuaKisb
@JoshuaKisb 4 жыл бұрын
have you posted the results somewhere. so i can look at them
@hiteshkhandar6087
@hiteshkhandar6087 4 жыл бұрын
Sir, can you explain, wchich better for use in project for security and performance....
@MuhammadFarhan-dy4ol
@MuhammadFarhan-dy4ol 2 жыл бұрын
How will it be laravel attendance Integration shift wise?
@PSRENJITH
@PSRENJITH 2 жыл бұрын
No one said about stored procedure why?
@mrkisilmike
@mrkisilmike 3 жыл бұрын
what about "sql no cache"?
@partikpatel5655
@partikpatel5655 3 жыл бұрын
if there is one scenario in which we may have to implement Mongo DB in future instead of mysql database currently we have in our project. then, what should be the preferred way to write all queries using Eloquent or Using Query Builder. Can you please create a video with all the pros and cons of both and how we use different database when we needed by just changing database type
@RealHomeboy
@RealHomeboy 2 жыл бұрын
If you want total abstraction bewteen models and persistence, use Doctrine in Laravel instead of Eloquent.
@msdeav
@msdeav 2 жыл бұрын
thank you...
@AnirudhBabbar
@AnirudhBabbar 3 жыл бұрын
Hi!! Which chrome addon you are using for this video?
@PovilasKorop
@PovilasKorop 3 жыл бұрын
It's not a chrome addon, it's Laravel Debugbar package
@ujongg
@ujongg 4 жыл бұрын
How to get the in-browser console laravel?
@PovilasKorop
@PovilasKorop 4 жыл бұрын
It's Laravel Debugbar: github.com/barryvdh/laravel-debugbar
@tejaspatel1810
@tejaspatel1810 5 жыл бұрын
May I know which tool you are using for query log?
@PovilasKorop
@PovilasKorop 5 жыл бұрын
Laravel Debugbar, if that's what you meant by "query log".
@tejaspatel1810
@tejaspatel1810 5 жыл бұрын
@@PovilasKorop yes. Excatly. Thanks
@NathanBudd
@NathanBudd 5 жыл бұрын
This is really interesting. What columns do you have indexes on for these queries?
@LaravelDaily
@LaravelDaily 5 жыл бұрын
Don't remember now, to be honest, I don't think I added any indexes, except for the ones automatically added with foreign key columns.
@NathanBudd
@NathanBudd 5 жыл бұрын
@@LaravelDaily It would be interesting to run the same query, but with the name column indexed for Elloquent.
@jashanpreet832
@jashanpreet832 3 жыл бұрын
What's difference between query builder and elequent please explain me in brief
@PankajSingh-hz2gr
@PankajSingh-hz2gr 3 жыл бұрын
In query builder you can fetch data from database by using DB . But if you go with eloquent model then u have to create model to fetch data
@lloricode
@lloricode 5 жыл бұрын
what editor are you using?
@PovilasKorop
@PovilasKorop 5 жыл бұрын
PHPStorm.
@lloricode
@lloricode 5 жыл бұрын
thanks
@lloricode
@lloricode 5 жыл бұрын
yung db query builder when getting data with relationship is much better
@kirchann
@kirchann 2 жыл бұрын
Its more readable
@webturtlesvlog
@webturtlesvlog 4 жыл бұрын
I always prefer query builder, but interviewer always stick with the eloquent.
@PankajSingh-hz2gr
@PankajSingh-hz2gr 3 жыл бұрын
Same with me 😃
@MargaRizaldiChannel
@MargaRizaldiChannel 2 жыл бұрын
Optimized eloquent will perform just slightly slower (almost unnoticeable) and a bit more "expensive" than query builder, but eloquent comes with uncompromised advantages like maintainability and scalability for future developments... That's why a company will always want eloquent as they need to see the future, not just the "current speed" which is historically proven will always be boosted by the technologies themselves (php, mysql, server, networking, etc.) over the time... So be wise developer... Cheers
@opentech5972
@opentech5972 5 жыл бұрын
10,000 book at same time , who gonna query that btw . and you did not print result on test 2 and 3 so i think that effect results .on prccess.
@taghwomillionaireo.5543
@taghwomillionaireo.5543 5 жыл бұрын
haven't seen that done anywhere
@chasadurrehman2306
@chasadurrehman2306 4 жыл бұрын
I build a web app for a client and it was a requirement to fetch all the questions ( 10K+ ) from the database (No pagination, No Ajax ... nothing) it was a requirement to get all the data at once. There can be many cases when you need to query much bigger data then you think.
@ashishrawat5712
@ashishrawat5712 4 жыл бұрын
@@chasadurrehman2306 but you can always use laravel chunk to get the data in chunks instead of fetching all the records
@FaizanAnwerAli
@FaizanAnwerAli 3 жыл бұрын
10000 is relatively very small number. Let's say your site grow by millions and you have a query which joins six or seven table (which usually happens) then Eloquent won't work that well because of not optimized query.
@ShabbeyRoadMusic
@ShabbeyRoadMusic 3 жыл бұрын
@@FaizanAnwerAli "Eloquent won't work that well" .. you think? You're right. It will suck, it will crash your app. Be a real programmer, learn SQL, use it. (not speaking directly to you because you obviously already know this, just trying to get people to realize they should not use the ORM for everything).
@TheBlessingOfTurnip
@TheBlessingOfTurnip 4 жыл бұрын
SPOILER Eloquent: 0.5 sec SQL Builder: 0.05 sec
@kirchann
@kirchann 2 жыл бұрын
Its not thuth challenge. Getting different result in each test.
@orhanahmadov9381
@orhanahmadov9381 5 жыл бұрын
laraveldaily.com not working
@PovilasKorop
@PovilasKorop 5 жыл бұрын
Thank you, fixed.
@orhanahmadov9381
@orhanahmadov9381 5 жыл бұрын
@@PovilasKoropthanks. ))
@PlayGameToday
@PlayGameToday 4 жыл бұрын
your macbook is trotlinng )))) xDDDD thats why eloquent stucks
@stormcorexz
@stormcorexz 5 жыл бұрын
that is a good one , but why all the heap about eloquent , i mean performance is every thing, can i sacrifice the performance in exchange of having flexible object in eloquent way
@juanpadilla8760
@juanpadilla8760 4 жыл бұрын
Performance is hardly everything. Most of the SMEs won't reach a point where the data they have becomes a bottleneck for the application. So what do you get with eloquent? Development speed. Use the right tool for the job always.
@ShabbeyRoadMusic
@ShabbeyRoadMusic 3 жыл бұрын
@@juanpadilla8760 Lol, "Performance is hardly everything". You go and tell that to the corporations that have hired me to come in and fix their scripts that ran for hours by converting the ORM/Eloquent/Doctrine junk to Raw SQL. After those conversions, the scripts ran in milliseconds instead of hours. Every time. Use the right tool for the job. Always. For databases of any significant size and complexity, that tool is SQL, or at least Query Builder - not these Active Record, or Entity, or Dapper ORMs.
@juanpadilla8760
@juanpadilla8760 3 жыл бұрын
@@ShabbeyRoadMusic I'm not sure what's your point, I agree that in the case of corporations that may not be the right tool for the job, but SMEs make up 99.8% of all the businesses in Europe... As I mentioned, more often than not the queries to run are not extremely complex and the volume of users is rather low in those cases. And with limited resources, development speed can make it or break it.
@ShabbeyRoadMusic
@ShabbeyRoadMusic 3 жыл бұрын
@@juanpadilla8760 Point taken, Juan. But I always think about how a database might scale up when I'm developing. If a developer has confidence a SME won't become a BBVA or a Marfeel, then it's fine to go the easy & quick route.
@petrg.3752
@petrg.3752 5 жыл бұрын
This is why Eloquent model has Eager Loading , look into it
@MaizerGomes
@MaizerGomes 5 жыл бұрын
That is eager loading. What's your point?
@sharkinc4563
@sharkinc4563 5 жыл бұрын
Dont fight
@MarkoPetejan
@MarkoPetejan 4 жыл бұрын
Well, for an actual library software, none of the examples would work. You would need complex SUID (CRUD) stored procedures (selects with input parameters) behaving like a table. You can not select directly from table(s) it is impossible to make such software like that. You can not manipulate the data outside the database except for a small resultset. By the way, book title and author are two properties out of more than a thousand and most of them are repeatable (ie multiple authors). And also "where title like %a%" is not usable, you have to search for every criteria (property) and for every word of search and for values in book and then combine results (some may have more than 100 thousand hits) with intersection.
Eloquent or Query Builder: When to Use Which?
5:48
Laravel Daily
Рет қаралды 87 М.
DONT USE AN ORM | Prime Reacts
25:46
ThePrimeTime
Рет қаралды 213 М.
WHAT’S THAT?
00:27
Natan por Aí
Рет қаралды 11 МЛН
Does size matter? BEACH EDITION
00:32
Mini Katana
Рет қаралды 19 МЛН
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 56 МЛН
Raw SQL, SQL Query Builder, or ORM?
16:19
ArjanCodes
Рет қаралды 96 М.
The Hidden Cost Of GraphQL And NodeJS
28:35
ThePrimeTime
Рет қаралды 186 М.
Why Don't We Have A Laravel For JavaScript?
12:36
Theo - t3․gg
Рет қаралды 90 М.
Why is Laravel NOT used in Big Development Projects?
11:53
Stefan Mischook
Рет қаралды 173 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 179 М.
Laravel Octane: supercharge your Laravel applications
8:34
Aaron Francis
Рет қаралды 34 М.
Laravel Eloquent: Deeper Relationships with One Query
10:37
Laravel Daily
Рет қаралды 138 М.
Optimizing Eloquent: Running Out Of Memory?
6:11
Laravel Daily
Рет қаралды 42 М.
Loop? ❤️ #behindthescenes ?
0:11
The Quinetto's
Рет қаралды 12 МЛН
Застрял в КУБЕ😱
0:21
Koko Nicole
Рет қаралды 1,5 МЛН
Amazing weight loss transformation !! 😱😱
0:24
Tibo InShape
Рет қаралды 13 МЛН
What’s In This Box?
0:51
Clean Girl
Рет қаралды 21 МЛН