Using $orderby=FileRef desc on large document libraries in SharePoint Online can have significant implications regarding resource consumption, latency, and throttling risks.
Resource Consumption
Sorting by FileRef instead of the default ID may indeed consume more Resource Units (RUs) per call. The operation could require a non-clustered index seek, which is generally more resource-intensive than a clustered index scan that would occur with ID-based sorting. This increased resource consumption could lead to depleting your throttling quota more quickly, especially under heavy load or frequent queries.
Latency
Regarding server-side latency, adding this sort order can introduce measurable delays. The SharePoint engine must process the sort order before it can stream the data, which could affect the Time-to-First-Byte (TTFB) for the first page of results. This is particularly relevant in large libraries, where the overhead of sorting can be more pronounced.
Throttling Risks
Using this specific sort operation is likely to be considered a more complex query, which increases the risk of triggering HTTP 429 errors or hitting the List View Threshold (5,000 item limit). Complex queries can lead to throttling, especially if they are executed frequently or if they are part of a larger pattern of high-volume requests.
Given these factors, relying on this sort order in large-scale ingestion scenarios may be considered an anti-pattern. It would be advisable to evaluate your architecture and consider alternative approaches that minimize resource consumption and latency while avoiding throttling risks.
References: