I'm using ArcGIS Desktop 10.7. Concerning the Sort (data management) tool (described here😞 Say I specify 3 sort fields, and there are records that have matching values for all 3. How does the tool decide which of those records are sorted first? Does it go by OBJECTID value, or another field? Is it random?
Esri's documentation doesn't address the question, likely because the behavior could vary by back-end datasource or DBMS.
Most, if not all, DBMSs only guarantee the result set order stated by an ORDER BY clause. Any ordering outside of an ORDER BY clause may change between executions. It doesn't mean the ordering between executions will change, just that it may change if the fields/columns aren't part of an ORDER BY clause. The underlying reason is that a query optimizer is free to choose a different execution plan every time it executes a query, and fields/columns that aren't part of an ORDER BY clause may be processed or retrieved in a different order with different execution plans.