https://questdb.io logo
Title
j

Jenny Lian

10/25/2022, 4:29 AM
I was reading this issue https://github.com/questdb/questdb/issues/353 and I verified this is sorted, but I can’t explain why… can some one help me please understand why this is sorted? Seems like there’s this method called doQueryRecordLoop, I’m not sure what is
columnCount
but some how all the records are in alphabetical order and it’s wrtten directly into the socket… can some one give me a overview please?
a

Andrey Pechkurov

10/25/2022, 6:36 AM
Hi Jenny, You should be looking into
TableListRecordCursorFactory
. Currently we don't enforce the order and whether the result set is sorted or not depends on
FilesFacade#findFirst()/findNex()
.
On Linux, MacOS and BSD it boils down to `readdir(3)`: https://man7.org/linux/man-pages/man3/readdir.3.html
The order in which filenames are read by successive calls to readdir() depends on the filesystem implementation; it is unlikely that the names will be sorted in any fashion.
That's why you observe sorted results, but it doesn't mean that you would see the same behavior on a different file system and/or OS.