Commit bf617db8 authored by serg@infomag.ape.relarn.ru's avatar serg@infomag.ape.relarn.ru
Browse files

Merge

parents 563fdb8e 883042ba
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
tim@localhost.polyesthetic.msg
tim@work.mysql.com
monty@work.mysql.com
tonu@work.mysql.com
sinisa@work.mysql.com
paul@work.mysql.com
jamppa@work.mysql.com
bk@work.mysql.com
davida@work.mysql.com
jamppa@work.mysql.com
jcole@jcole.burghcom.com
matt@work.mysql.com
serg@work.mysql.com
bk@work.mysql.com
monty@work.mysql.com
paul@work.mysql.com
sasha@mysql.sashanet.com
sasha@work.mysql.com
jcole@jcole.burghcom.com
serg@infomag.ape.relarn.ru
serg@work.mysql.com
sinisa@work.mysql.com
tim@localhost.polyesthetic.msg
tim@work.mysql.com
tonu@work.mysql.com
+0 −2
Original line number Diff line number Diff line
# Monty

# Normally you do not need to remake the files here. But if you want
# to you will need the GNU TeX-info utilities. To make a Postscript
# files you also need TeX and dvips. To make the PDF file you will
+22 −0
Original line number Diff line number Diff line
@@ -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

+303 −383

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ int heap_rnext(HP_INFO *info, byte *record)
      pos=0;					/* Read next after last */
      my_errno=HA_ERR_KEY_NOT_FOUND;
    }
    else if (!info->current_ptr && (info->update & HA_STATE_PREV_FOUND))
    else if (!info->current_ptr)		/* Deleted or first call */
      pos= _hp_search(info,share->keydef+info->lastinx, info->lastkey, 0);
    else
      pos= _hp_search(info,share->keydef+info->lastinx, info->lastkey, 1);
Loading