Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Sorting by RecId

(0) ShareShare
ReportReport
Posted on by
I see lots of code samples that access records in a table while sorting them on recId. I would think CreatedDateTime is a better field to sort on, if enabled.
 
Is it always guaranteed that every new record in a table receives a record id greater than the previous one?
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,934 Most Valuable Professional on at
    Sorting by RecId
    No, it's not guaranteed that the order of record IDs matches the order of creation. For example, you have two AOS servers, both pre-allocate 50 record IDs from the sequence, e.g. 1-50 and 51-100. The second AOS will create records with IDs 51 and 52 and only then the first AOS will create a record with ID 1.
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,111 Super User 2025 Season 1 on at
    Sorting by RecId
    Hi SMC,
     
    Usually, the record ID is greater for newer records. SQL sequence technology is used. In many cases, there is an index created for the RecId field and not for the CreatedDateTime. Sorting on a non-indexed field is slower compared to retrieving the records in order of an index.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,111 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,934 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans