Eloquent vs Query Builder vs SQL: Performance Test

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

Laravel Daily

Laravel Daily

5 жыл бұрын

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

Пікірлер: 53
@CEOofCunnySlurper
@CEOofCunnySlurper 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....
@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 Жыл бұрын
If you want total abstraction bewteen models and persistence, use Doctrine in Laravel instead of Eloquent.
@MuhammadFarhan-dy4ol
@MuhammadFarhan-dy4ol 2 жыл бұрын
How will it be laravel attendance Integration shift wise?
@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.
@mrkisilmike
@mrkisilmike 3 жыл бұрын
what about "sql no cache"?
@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
@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
@PSRENJITH
@PSRENJITH 2 жыл бұрын
No one said about stored procedure why?
@lloricode
@lloricode 5 жыл бұрын
what editor are you using?
@PovilasKorop
@PovilasKorop 5 жыл бұрын
PHPStorm.
@lloricode
@lloricode 5 жыл бұрын
thanks
@ujongg
@ujongg 4 жыл бұрын
How to get the in-browser console laravel?
@PovilasKorop
@PovilasKorop 4 жыл бұрын
It's Laravel Debugbar: github.com/barryvdh/laravel-debugbar
@jashanpreet832
@jashanpreet832 3 жыл бұрын
What's difference between query builder and elequent please explain me in brief
@PankajSingh-hz2gr
@PankajSingh-hz2gr 2 жыл бұрын
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
@msdeav
@msdeav 2 жыл бұрын
thank you...
@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 2 жыл бұрын
@@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).
@lloricode
@lloricode 5 жыл бұрын
yung db query builder when getting data with relationship is much better
@kirchann
@kirchann 2 жыл бұрын
Its more readable
@webturtlesvlog
@webturtlesvlog 3 жыл бұрын
I always prefer query builder, but interviewer always stick with the eloquent.
@PankajSingh-hz2gr
@PankajSingh-hz2gr 2 жыл бұрын
Same with me 😃
@MargaRizaldiChannel
@MargaRizaldiChannel Жыл бұрын
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
@orhanahmadov9381
@orhanahmadov9381 5 жыл бұрын
laraveldaily.com not working
@PovilasKorop
@PovilasKorop 5 жыл бұрын
Thank you, fixed.
@orhanahmadov9381
@orhanahmadov9381 5 жыл бұрын
@@PovilasKoropthanks. ))
@TheBlessingOfTurnip
@TheBlessingOfTurnip 3 жыл бұрын
SPOILER Eloquent: 0.5 sec SQL Builder: 0.05 sec
@kirchann
@kirchann 2 жыл бұрын
Its not thuth challenge. Getting different result in each test.
@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 3 жыл бұрын
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 2 жыл бұрын
@@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 2 жыл бұрын
@@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 2 жыл бұрын
@@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.
@PlayGameToday
@PlayGameToday 3 жыл бұрын
your macbook is trotlinng )))) xDDDD thats why eloquent stucks
@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
Рет қаралды 86 М.
Cache Eloquent Query Results to Load Pages Instantly
5:43
Laravel Daily
Рет қаралды 59 М.
100😭🎉 #thankyou
00:28
はじめしゃちょー(hajime)
Рет қаралды 37 МЛН
La final estuvo difícil
00:34
Juan De Dios Pantoja
Рет қаралды 28 МЛН
Black Magic 🪄 by Petkit Pura Max #cat #cats
00:38
Sonyakisa8 TT
Рет қаралды 21 МЛН
Flutter : App lập kế hoạch cá nhân
21:20
Hoài Trang 2k3
Рет қаралды 3
SQL Databases with Pandas and Python - A Complete Guide
16:59
Rob Mulla
Рет қаралды 104 М.
Eloquent: Query 3-Level Relations with hasManyThrough and withCount
7:36
SQL indexing best practices | How to make your database FASTER!
4:08
Raw SQL, SQL Query Builder, or ORM?
16:19
ArjanCodes
Рет қаралды 93 М.
Why I Sometimes Use query() Method?
2:26
Laravel Daily
Рет қаралды 15 М.
Wanna Start with Filament? Quick 5-Minute Demo.
7:50
Laravel Daily
Рет қаралды 6 М.
Laravel Eloquent: Deeper Relationships with One Query
10:37
Laravel Daily
Рет қаралды 135 М.
ФОТОШОП СВОИМИ РУКАМИ (@photoscapesbyclare - IG)
0:30
В ТРЕНДЕ
Рет қаралды 18 МЛН
会变色的西施龙凤凤鸣壶#凤鸣壶 #西施壶
0:52
壶棚杯友
Рет қаралды 19 МЛН
Sigma Girl Education #sigma #viral #comedy
0:16
CRAZY GREAPA
Рет қаралды 79 МЛН