Sure but there's still TBs of data to check? Ideally it uses a data structure like a tree or hash that's efficient for searching through that amount of data (which might just be an index in a relational DB).
That's like saying every S3 request searches though exabytes of data. No, each request only access the data it needs. Yes, the dataset is large but "each request" only reads a few megabytes at most.