There are two main ways to make such a simple request.
First, you need to perform a full table scan. This will have O (n) performance.
The second is finding the value in the index, loading the page, and returning the results. Index scan should be O (log (n)). The page load should be O (1).
With a more complex query, it would be difficult to make such a general statement. But any SQL engine will usually take one of these two paths. Oh, there is a third option if the table is split by author_id, but you are probably not interested in this.
However, the strength of the database is not in these details. He is in memory management. The database will cache data and indexes in memory, so you do not need to re-read the data pages. The database will use several processors and several disks, so you do not need to encode it. The database retains all consistency in the face of updates and deletions.
Regarding your specific question. If the data is in the database, search there. Downloading all the data in an xml file and then doing a memory search requires a lot of overhead. You would only like to do this if the connection to your database is slow and you make a lot of such queries.
source share