ref_ queries are one of those ServiceNow features that are useful, slightly obscure, and easy to misuse.
They show up when you start from a base table such as task, but need to filter on a field that exists only on a child table such as incident.caller_id.
ACLs are easy to treat as a pure security feature and forget that they also sit on a hot path.
When an instance loads a form, renders a list, or reads fields through server-side code, ACL evaluation can happen many times. That is why small misunderstandings in ACL design turn into both security confusion and avoidable performance cost.
Client scripts get slow and noisy when every small decision turns into another server call.
Most of the time, the real problem is not the API. It is choosing the wrong moment to fetch data.
Querying tables is one of those things that looks harmless until the same script runs against production-sized data. A query that feels fine with a few hundred records can become slow, expensive, and noisy when the table grows.
These are the habits I try to keep in every ServiceNow script that reads data.
1. Filter in the query, not in the loop The most common mistake is querying a broad set of records and then doing the real filtering inside while (gr.next()).