All,
I have been thinking about some possible performance improvements to the way
that External Sorts are handled but want to be sure I understand the current
logic.
Say I submit a query which will return a row set which will be larger than the
defined internal sort size (even if server has 32TB of RAM).
(For this discussion, I do not believe that whether the query performs a
natural scan or uses index matters, this is about discussing how the external
sort logic works)
My high-level/pseudo-code understanding of the logic is:
Procedure Main;
...
ExternalSortFlag = 0
TempSortBlock = null
Reading = true
loop
Load data into TempSortBlock
if size of TempSortBlock > InternalSortSize then
ExternalSort Flag = 1
Call ExecuteWriteTempSortBlock( TempSortBlock)
endif
If EOF() then Reading = false
while Reading
// reading finished
If ExternalSort Flag = 1 then
ExecuteWriteTempSortBlock()
ExecuteExternalSort()
else
ExecuteInternalSort()
endif
...
end;
Procedure ExecuteWriteTempSortBlock( TempSortBlock);
...
Write TempSortBlock to TempSortFile
TempSortBlock = null
...
End;
I realize that there is *much more* involved (preparing query BLR, initiating
BLR execution, tracking temp file size, tracking multiple temp files...), those
details are not significant for the moment.
So, here are my questions:
1- A query's operations (the reading of the data and sorting) execute in a
single thread/process, correct?
2- Is Internal sorting performed by the ExecuteWriteTempSortBlock() step?
3- Does sorting use pointers to row sort data or are the rows moved in
memory during sort?
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