In this article MySql vs MongoDB performance benchmark, they defined two measurements:
- select time
- run time (select + fetch)
I do not understand what the difference is between these two. Can someone explain what the select time and fetch time are?
The benchmark you cited is using the term "select time" to mean the amount of time that elapses between when the time when the query is sent to the server for execution and the time when the first row is available for retrieval. The "fetch time" is the difference between when the first row is available to the client and the last row has been retrieved by the client.
"Select time" then means the amount of time the server spends identifying the rows that will be returned, and "Fetch time" means the amount of time required for the server to actually deliver all of the data to the client.
In the simplest query,
SELECT * FROM t1, where the server has to do almost no work in order to identify which rows should be returned (all rows would be returned, with no
WHERE clause), we could expect that the select time would be almost instantaneous, while the fetch time would depend on how fast the server can read the rows from its backing store (or cache) as well as the available network bandwidth and latency between the server and the client. In a more complicated query, where the server has to do more work to identify the rows, the select time could be much higher and the fetch time could be lower by comparison.
In summary, "Select time" is an estimate, based on observation from the client's perspective, of how fast the server can identify the rows to be returned, while "Fetch time" is how fast the server can actually deliver them once they have been identified.
The two times added together are the actual time required for your query to be fully answered. In light of that, the only thing that really matters is the total, since that's how long you're going to have to wait until you can use the entire result set.