Spring Data JPA | Query Hints | Optimize Database Performance | Hands-On Guide

  Рет қаралды 16,029

Java Techie

Java Techie

Күн бұрын

#JavaTechie #Microservice #SpringBoot #JPA
👉 In this tutorial, we dive deep into Query Hints in Spring Data JPA. Learn how to leverage them to optimize query performance with practical, real-world examples.
What You’ll Learn:
👉 What are Query Hints?
👉 The different types of Query Hints.
👉 A hands-on example with step-by-step implementation.
👉 Performance comparison: before and after using Query Hints.
🧨 Hurry-up & Register today itself!🧨
Devops for Developers course (Live class ) 🔥🔥:
javatechie.ong...
COUPON CODE : NEW24
Spring boot microservice Premium course lunched with 70% off 🚀 🚀
COURSE LINK : Spring boot microservice course link :
javatechie.ong...
PROMO CODE : SPRING50
GitHub:
github.com/Jav...
Blogs:
/ spring-data-jpa-query-...
Facebook:
/ javatechie
Join this channel to get access to perks:
www.youtube.co...
🔔 Guys, if you like this video, please do subscribe now and press the bell icon to not miss any update from Java Techie.
Disclaimer/Policy:
📄 Note: All uploaded content in this channel is mine and it's not copied from any community, you are free to use source code from the above-mentioned GitHub account.

Пікірлер: 71
@manishkeshari5096
@manishkeshari5096 Ай бұрын
East or West, Java Techie is the best ❤
@MohamedKaanoun
@MohamedKaanoun Ай бұрын
Bro deserves 100M subscribers
@Javatechie
@Javatechie Ай бұрын
I don't know the true buddy whether i could reach even 1M or not however This word is enough for me to boost 🥰
@reshmasoni7671
@reshmasoni7671 Ай бұрын
I think gold button from KZbin ❤❤❤
@richardvincent3979
@richardvincent3979 Ай бұрын
Not 100M please, 1Billion. Your information are always relevant. Thank you for consistently delivering value. You are the best
@Javatechie
@Javatechie Ай бұрын
Thank you Richa for your good wishes 🥰. Keep learning 😊
@subhbirajdar
@subhbirajdar Ай бұрын
Interesting video for db performance
@ravirajsaraganachari3038
@ravirajsaraganachari3038 Ай бұрын
I request you to continue the same as it will help many in building their careers. Wishing you great success and may God bless you for your incredible efforts, sir. ❤
@goodcourseavailable
@goodcourseavailable Ай бұрын
Amazing tutor on KZbin.. 1M subscribers soon 🎉
@Javatechie
@Javatechie Ай бұрын
Thank you so much buddy for your kind words 😊. Keep learning 😊
@rameshbabub5243
@rameshbabub5243 Ай бұрын
I didn't know we can do this, thanks for this tutorial
@ravindrakushwahakrishna
@ravindrakushwahakrishna Ай бұрын
Thanks sir for everything
@tufankarmakar4497
@tufankarmakar4497 Ай бұрын
Thanks for sharing such a usefull video
@KenanSevinmedik-u5f
@KenanSevinmedik-u5f Ай бұрын
Thank you brother. I love Java Techie!
@skaftab3954
@skaftab3954 Ай бұрын
Bro these are premium stuff. I am surprised by the number of subscribers.
@anandnigade5886
@anandnigade5886 Ай бұрын
I was also searching for the same. Thank you so much 🎉
@Rakeshcp-g7w
@Rakeshcp-g7w Ай бұрын
Thanks for sharing 👍
@VikashRai_07
@VikashRai_07 Ай бұрын
Thanks! 🙂
@erbharat2022
@erbharat2022 Ай бұрын
Thank you 🙏🏻
@satyamsundaram-r4n
@satyamsundaram-r4n Ай бұрын
Thanks❤🙏
@GKK31
@GKK31 Ай бұрын
Thanks for sharing
@ALLinONE121
@ALLinONE121 Ай бұрын
Great 👍
@henrivalencia21
@henrivalencia21 Ай бұрын
thank you.
@karthikravisankar5608
@karthikravisankar5608 Ай бұрын
Could you please post a video on the jpa specification interface
@girishputtaraju8581
@girishputtaraju8581 Ай бұрын
Hello Basat, Please make video for gRPC synchronous communication
@siyamuddin
@siyamuddin Ай бұрын
Impressive
@praveenkchowdam
@praveenkchowdam Ай бұрын
Hello bro . Your explanation is good . one request from my end. please create one springboot +react (crud application) with all the features like api gateway and spring security ,kafka , redis cache , postgres db . I already requested so many times in the comments . please make one video on that , it will be helpful for others also.
@Javatechie
@Javatechie Ай бұрын
Sure buddy will do that
@praveenkchowdam
@praveenkchowdam Ай бұрын
@@Javatechie thank you. I am waiting 🙂
@shubhamthakare1599
@shubhamthakare1599 Ай бұрын
please explain about Optimistic vs. Pessimistic Locking in Spring Data and thank you for this video
@Javatechie
@Javatechie Ай бұрын
Sure good suggestion 👍. Noted ✅️
@joshipratik3381
@joshipratik3381 Ай бұрын
​@@Javatechie, Thanking you in anticipation.
@azharmobeen
@azharmobeen Ай бұрын
Thanks for sharing but in Spring data jpa we have @Transactional(readOnly = true) and similary we have paggination as well. why we need to use QueryHint ? what's the main advantage ?
@Javatechie
@Javatechie Ай бұрын
Transaction ment to avoid data inconsistency buddy however Query hints will help to boost your query performance on the fly applying inbuilt support on query itself
@vndprasadgrandhi4344
@vndprasadgrandhi4344 Ай бұрын
Thank you very much sharing information bro..Plz plan java 9 to java11 series from your way and Waiting lot of persons same
@veerraju8445
@veerraju8445 27 күн бұрын
using query hints,page size was set to 50 but in response we got all records?
@rajesh.gundabathula
@rajesh.gundabathula Ай бұрын
HI Bro now a days every one discussing about AI and chat gpt will be in future what type of evolution can be happening in java.can we include AI in java for our daily work
@vikrambaliga7241
@vikrambaliga7241 Ай бұрын
How long does the value stay in cache,also why did time out if time out was set to 2000, when the response 1029
@tubemekala
@tubemekala Ай бұрын
I also have same question why did time out if time out was set to 2000, when the response 1029?
@Javatechie
@Javatechie Ай бұрын
Guys, that's exactly what I mentioned. The response time may vary. For example, the first time I tried, it took over 2000 ms. However, after a restart, it took only 1029 ms on the second attempt. If you restart and retry again, the response time could exceed 2000 ms or drop below 1029 ms
@Javatechie
@Javatechie Ай бұрын
If no explicit cache duration is configured in your cache provider, the cache entries will remain until they are evicted due to memory constraints, manual eviction, or application restart.
@vikrambaliga7241
@vikrambaliga7241 Ай бұрын
@@Javatechie Thanks Sir
@girishvm2335
@girishvm2335 Ай бұрын
Timeout is not required right technically Let it take the actual time as we optimised the method using queryhint know .
@Anilkumar-reddy
@Anilkumar-reddy Ай бұрын
Good Video as always♥, one doubt here. In video iu mentioned in the quertHint annotatios as fetch size is 50 right. after calling the api, did u get the records in 1lakh++ or only 50
@Javatechie
@Javatechie Ай бұрын
No let me clear your doubts , fetchSize controls how many rows the JDBC driver fetches in one go from the database cursor but doesn’t limit the total records returned by the query. For example, with fetchSize=50, the driver fetches rows in chunks of 50, optimizing memory usage for large datasets. However, all rows matching the query will still be returned unless explicitly limited using setMaxResults() or a LIMIT clause. For instance, if a query matches 1000 rows, they’ll be fetched in 20 chunks of 50 but all 1000 rows will be returned unless otherwise restricted. Hope this make sense
@Anilkumar-reddy
@Anilkumar-reddy Ай бұрын
@ Thank you for detail explaination👌👌🙌
@girishrp9339
@girishrp9339 Ай бұрын
Basat request you please answer this question Why introduced Java 8 static and default method in interface and abstract class already used it? Can you tell me real time example
@Javatechie
@Javatechie Ай бұрын
Girish i have covered this video on my interview QA series please have a look once , after watching if you are unclear then please feel free to let me know
@yashwanthv1092
@yashwanthv1092 Ай бұрын
Great content from you as usual. Thanks a ton. Can you make a video on how to optimise update, delete and insert queries.
@Javatechie
@Javatechie Ай бұрын
Okay 👍
@ash-1908
@ash-1908 Ай бұрын
When we use Queryhint for saving query response to cache, if the data in database is always changing, how will it help ? Because the cache data will not be in sync if database data is changed right ?
@Javatechie
@Javatechie Ай бұрын
It will update once you try fetching the records . Not sure how it does will check and update buddy
@weitanglau
@weitanglau Ай бұрын
Can you make a Spring Data JDBC video? Simpler than JPA
@Javatechie
@Javatechie Ай бұрын
Okay sure will do that
@karthiksundaram544
@karthiksundaram544 Ай бұрын
🎉
@girishrp9339
@girishrp9339 Ай бұрын
Can do make video of jpa save performance. In real time am facing 15sec to save into 3tables using oneTOMany relationship with Eager loading
@Javatechie
@Javatechie Ай бұрын
Okay sure I will plan but can you elaborate your usecase what is the payload size you are persisting to DB is this in bulk or single nested payload ?
@girishrp9339
@girishrp9339 Ай бұрын
iterating one record at time hearder table 1 record Details table 3 records Under details child table 4 records 3 tables one-to-many relationship Please make eager and lazy loading I didn't understand others videos still confused when to use fetchType.Eager and Lazy. One interview asked didn't given proper example
@Javatechie
@Javatechie Ай бұрын
@@girishrp9339 thanks for clear picture let me try to reproduce this exact scenario and will update you buddy
@thurlukulasekhar223
@thurlukulasekhar223 Ай бұрын
Small doute if it taken 1029 but why it thorws exception 2000 limit time
@Javatechie
@Javatechie Ай бұрын
When first time I ran it might took more than 2 sec that's why we get error. Second time it took only 1029 ms So the fact is that it will varry , for example if i will run 5 times in my local every time it won't give you the same result buddy
@XprimeX-q7l
@XprimeX-q7l Ай бұрын
hey the fetched size was 50 but it bought 196504 records how? and where was cache?
@Javatechie
@Javatechie Ай бұрын
No what it does is , fetchSize controls how many rows the JDBC driver fetches in one go from the database cursor but doesn’t limit the total records returned by the query. For example, with fetchSize=50, the driver fetches rows in chunks of 50, optimizing memory usage for large datasets. However, all rows matching the query will still be returned unless explicitly limited using setMaxResults() or a LIMIT clause. For instance, if a query matches 1000 rows, they’ll be fetched in 20 chunks of 50 but all 1000 rows will be returned unless otherwise restricted.
@RohitSingh-sd2hn
@RohitSingh-sd2hn Ай бұрын
i couldn't find your design pattern playlist, can you please post that playlist link.
@RohitSingh-sd2hn
@RohitSingh-sd2hn Ай бұрын
finally can i get rid of redis cache ?
@Javatechie
@Javatechie Ай бұрын
Redis complete Playlist is there buddy just click on Playlist section of javatechie you will find everything . Do let me know incase still you are facing issues
@akhill357
@akhill357 Ай бұрын
Where's pagination implemented here, you got all records at once
@Javatechie
@Javatechie Ай бұрын
FetchSize will load chunk of records on batch on the fly buddy. That's what the magic
@2RAJ21
@2RAJ21 Ай бұрын
Thank you
УЛИЧНЫЕ МУЗЫКАНТЫ В СОЧИ 🤘🏻
0:33
РОК ЗАВОД
Рет қаралды 7 МЛН
OCCUPIED #shortssprintbrasil
0:37
Natan por Aí
Рет қаралды 131 МЛН
5 REAL AI Agents We’ve Built in the Last 6 Months
18:10
Arseny Shatokhin
Рет қаралды 7 М.
Database Sharding and Partitioning
23:53
Arpit Bhayani
Рет қаралды 117 М.
Stop Mocking Your Database! Use Testcontainers in .NET
15:59
Milan Jovanović
Рет қаралды 10 М.
Pixel 7 и 7 Pro с Face ID - лучше iPhone 14 Pro!
21:12
Rozetked
Рет қаралды 457 М.
НИКОГДА не иди на сделку с сестрой!
0:11
Даша Боровик
Рет қаралды 729 М.
пранк🤣😂😂
0:51
Numdexx1
Рет қаралды 1,2 МЛН
LNS - 2 cô gái tốt bụng || Kind 2 girls #shorts
0:47
Linh Nhi Shorts
Рет қаралды 4,2 МЛН
ТЕЛЕФОН МЕНЯЕТ ЦВЕТ😅 #upx
0:34
RanF
Рет қаралды 639 М.