This merge request is meant to support the order by clause on non indexed fields.
If the query planner determines that the output is not already sorted, then an additional sorting step is added through a new type of reader: sortReader.
When the client attempts to read the first row on the sort reader, all rows gets fetched from the underlying reader and collected to a buffer. When the buffer contains at least 1024 rows, sorting is performed in memory and the sorted chunk is spilled to a temporary disk file. The process continues until all the result rows have been read.
At this point, sorted disk chunks (if any) are merged into a single bigger sorted chunk and a reader to such a file is returned to the client. If the output contains a number of rows <= 1024, then a reader to the buffer is simply returned.
coverage: 89.421% (-0.04%) from 89.459%
when pulling a2d377a4d35cb13b60cd202bae73144904fbc6dc on ostafen:feature/filesort
into e9e5c472210c7686be71386125bdf80947336b78 on codenotary:master.
This merge request is meant to support the order by clause on non indexed fields. If the query planner determines that the output is not already sorted, then an additional sorting step is added through a new type of reader:
sortReader
. When the client attempts to read the first row on the sort reader, all rows gets fetched from the underlying reader and collected to a buffer. When the buffer contains at least 1024 rows, sorting is performed in memory and the sorted chunk is spilled to a temporary disk file. The process continues until all the result rows have been read. At this point, sorted disk chunks (if any) are merged into a single bigger sorted chunk and a reader to such a file is returned to the client. If the output contains a number of rows <= 1024, then a reader to the buffer is simply returned.