-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite cost computation for filesort operations
This is a rework of how filesort calculates costs to allow functions like test_if_skip_sort_order() to calculate the cost of filesort to decide between filesort and using a key to resolve ORDER BY. Changes: - Split cost calculation of qsort + optional merge sort and priority queue to dedicated functions. - Fixed some wrong calculations of cost in old code (use of log() instead of log2()). - Added costs realted to fetching the rows if addon fields are not used. - Updated get_merge_cost() to take into account that we are going to read data from temporary files in big chuncks (DISK_CHUNCK_SIZE (64K) and not in IO_SIZE (4K). - More code documentation including various variables in Sort_param. One effect of the cost update is that the cost of priority queue with addon field has decreased slightly and is used in more cases. When the rowid is large (like with InnoDB where rowid is the priority key), using addon fields is in many cases preferable. Reviewer: Monty
- Loading branch information
Showing
8 changed files
with
474 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.