Dmitry, > > 1. A query's operations (the reading of the data and sorting) execute > > in a single thread/process, correct? > > Correct. > > > 2. Is Internal sorting performed by the ExecuteWriteTempSortBlock() > step? > > Internal buffer is sorted as soon as filled up to its limit and then written > into > the temp space. More or less what you describe, AFAIU. > Although in fact, runs (sorted buffers) may still reside in memory in other > (larger) buffers. And the temp space manager does its own caching as well.
Based on your answers to 1 and 2, this means that all read IO to load more data is paused while the internal buffer is sorted and then written to disk? Is there a reason (in today's age of multi-core CPUs and hyper-threading) why "helper threads" could not be created to perform the buffer sorting and temp disk IO? Personally, I find it frustrating to what Firebird disk IO profile when performing large select/sorts, on systems which have IO to burn (RAM Disk, SSD or PCIe SSD). > > 3. Does sorting use pointers to row sort data or are the rows moved in > > memory during sort? > > Rows are moved. This is done this way to avoid duplicated record fetches > (when sort results are retrieved) causing random I/O. Sorting itself may be > also highly I/O bound, but it always operates quite large blocks. Sorry, my question was poorly worded. I meant: is the select data which is loaded in the Internal buffer sorted by moving the rows or via pointers? (I understood that the Internal buffer contains all the output columns as well as the sort column (if not to be returned) Vlad provided the answer I was looking for. Sean ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available. Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel