summaryrefslogtreecommitdiff
path: root/Docs/internals.texi
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-08-15 20:09:37 +0300
committermonty@donna.mysql.com <>2000-08-15 20:09:37 +0300
commitea013c2152301e459504451efdb17f4c9bb30877 (patch)
tree5f72e7444fbc3c8d944a66b54b26550a04e4f0be /Docs/internals.texi
parent807460bbceceec25bf97352bc5e232c3e766d70f (diff)
downloadmariadb-git-ea013c2152301e459504451efdb17f4c9bb30877.tar.gz
Fixed for Ia64 + delayed key creation + a lot of small bug fixes
Diffstat (limited to 'Docs/internals.texi')
-rw-r--r--Docs/internals.texi22
1 files changed, 22 insertions, 0 deletions
diff --git a/Docs/internals.texi b/Docs/internals.texi
index 01f5b0a346c..06a9c1d9265 100644
--- a/Docs/internals.texi
+++ b/Docs/internals.texi
@@ -121,6 +121,28 @@ After this it will give other threads a possibility to open the
same tables.
@end itemize
+@node Filesort
+@chapter How do MySQL do sorting (filesort)
+
+- Read all rows according to key or by table-scanning.
+- Store the sort-key in a buffer (sort_buffer).
+- When the buffer gets full, run a qsort on it and store the result
+ in a temporary file. Save a pointer to the sorted block.
+- Repeate the above until all rows has been read.
+
+- Repeat the following until there is less than MERGEBUFF2 (15) blocks left.
+ - Do a multi-merge of up to MERGEBUFF (7) regions to one block in
+ another temporary file. Repeat until all blocks from the first file
+ is in the second file.
+- On the last multi-merge, only the pointer to the row (last part of
+ the sort-key) is written to a result file.
+
+- Now the code in sql/records.cc will be used to read through the
+ in sorted order by using the row pointersin the result file.
+ To optimize this, we read in a big block of row pointers, sort these
+ and then we read the rows in the sorted order into a row buffer
+ (record_buffer) .
+
@node Index
@unnumbered Index