Understand Apex Cursors To Improve SOQL Performance
ฝัง
- เผยแพร่เมื่อ 8 ก.ย. 2024
- Apex Cursors are a new beta feature in Salesforce Summer ’24 release that allows you to work with large datasets retrieved using SOQL queries. Unlike SOQL which returns the entire dataset at once, Cursors retrieve data in manageable chunks, improving performance and memory usage.
Cursors provide some advantages over Batch Apex, such as:
🛎️ Forward and backward navigation within the results.
🛎️ Ability to be chained in a series of queueable Apex jobs.
Cursor processing occurs within a single transaction, ensuring data consistency. Cursors are an alternative to batch Apex and address some of batch Apex’s limitations. Cursors are also more powerful because they can be used in a chain of queueable Apex jobs. In this video, I am explaining this new feature with a sample code snippet
#apex #apex-cursor #batch-apex #soql #largedata #performance #query #summer24
▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
0:01 - Introduction
0:23 - What is Apex Cursors?
1:14 - Advantages
3:03 - Things To Know
4:37 - Apex Cursors Limits
5:32 - Code Snippet
8:29 - Differences between Apex Cursors and Batch Apex
9:03 - Final Thoughts
📌 Blog - sudipta-deb.in...
📌 Automate User to Permission Set, Group, Queue Assignment in Salesforce | User Access Policies - • Automate User to Permi...
📌 Improved Salesforce Flow Address Component | How to use Google Map in Flow - • Improved Salesforce Fl...
📌 Use Flow Repeater Component To Collect Information And Create Records - • Use Flow Repeater Comp...
📌 Salesforce Summer 24 Release Playlist - bit.ly/3Ur0XCW
📌 Salesforce Spring 24 Release Playlist - bit.ly/3wyAB9I
📌 Salesforce Winter 24 Release Playlist - bit.ly/3P0bun0
📌 Salesforce Summer 23 Release Playlist - bit.ly/3Mw6rbx
📌 How To Add Named Credentials To Permission Set Using Principals - • How To Add Named Crede...
📌 Salesforce Flow Playlist - bit.ly/3nIpTnT
📌 HTTP Post Call From Salesforce Flow - • Salesforce Summer 23 R...
📌 External Services in Flow - HTTP Callout - • External Services in F...
📌 Salesforce Release Playlist - bit.ly/3r7F0cn
✨ Blog: www.sudipta-de...
✨ Subscribe for new videos on technology every week: bit.ly/3vCQKpg
✨Connect with me
📌 Twitter: / thesudiptadeb
📌 Website: www.sudipta-de...
📌 LinkedIn: / sudiptadeb
📌 Facebook: / technicalpotpourri
Credit: Music I Use under the Mixkit License
Disclaimer: All opinions are my own and this video content is not endorsed by Salesforce, Google or any other company in any way.
Thanks!! really helpful content...Please keep posting
Happy that you liked the video.
Sir you are doing great it's very helpful
Thanks and welcome
nice video
Thanks
So, are cursors a way to avoid retrieving data sets that potentially are too large? Contact for example has the change to retrieve more than the allowed limit of records.
Not only retrieve large data sets, bur process them efficiently by breaking into small manageable chunks.
@@TechnicalPotpourri and how does it distinguish from a Batch? Apart from having more freedom in the chunks you are processing using a cursor…
@PieterJacob - A batch size in batch Apex is limited to max 2K. Lets say you can process 4K records in a transaction you would need 2 jobs. With cursors just one job is enough. The idea is if you have a process that can run quickly use cursors. You can go upwards in that scope for cursors even beyond that 2K limit that batch has
@@TechnicalPotpourri Thanks a lot for your answer. I will test and try it out :).
Have a good day.
Is it advanced version of querylocator ?
No. It is a new feature.