Skip to content
  • Steinar H. Gunderson's avatar
    6d587a60
    Bug #30776132: MAKE FILESORT KEYS CONSISTENT BETWEEN FIELDS AND ITEMS · 6d587a60
    Steinar H. Gunderson authored
    Since the dawn of time, filesort has had different paths for making sort keys
    for fields and items. There's no good reason to keep carry this distinction
    forward anymore, so remove the special handling of Field and just sort Items
    everywhere, making filesort somewhat simpler. There are some special legacy
    cases with sorting enums etc. where we still need to look into Item_field and
    look at the actual underlying file type, but they are fairly localized and now
    much more visible.
    
    There are some edge cases where keys used to be shorter, e.g. all integers
    will now get 64-bit sort keys instead of 8-bit, 16-bit, etc.. Also, some
    EXPLAIN output changes, as we also no longer have specialized formatting of
    Field.
    
    WEIGHT_STRING() now is able to get the actual weight strings for more kinds
    of items, in particular integers.
    
    Inadvertently, we fix a bug that was only half-visible in the tests;
    common-tests.inc contain a query whose results were not properly deduplicated
    before, but are now, and while this was hidden by LIMIT/OFFSET, it affects
    which rows are visible in the result set.
    
    sysbench sorting tests (ranges and distinct ranges) show strong improvements
    at high thread counts; as much as +17%. Lower thread counts are neutral or
    in the noise.
    
    Unfortunately, replication started using Field::make_sort_key() in 8.0, and
    cannot easily change it back, as they need exact byte-by-byte matches of the
    data. Fixing this would enable removing 500+ lines of complicated sort key
    code.
    
    Change-Id: Ieb5038e8afbea19a5f0e0e7f83b3177cb3176e84
    6d587a60
    Bug #30776132: MAKE FILESORT KEYS CONSISTENT BETWEEN FIELDS AND ITEMS
    Steinar H. Gunderson authored
    Since the dawn of time, filesort has had different paths for making sort keys
    for fields and items. There's no good reason to keep carry this distinction
    forward anymore, so remove the special handling of Field and just sort Items
    everywhere, making filesort somewhat simpler. There are some special legacy
    cases with sorting enums etc. where we still need to look into Item_field and
    look at the actual underlying file type, but they are fairly localized and now
    much more visible.
    
    There are some edge cases where keys used to be shorter, e.g. all integers
    will now get 64-bit sort keys instead of 8-bit, 16-bit, etc.. Also, some
    EXPLAIN output changes, as we also no longer have specialized formatting of
    Field.
    
    WEIGHT_STRING() now is able to get the actual weight strings for more kinds
    of items, in particular integers.
    
    Inadvertently, we fix a bug that was only half-visible in the tests;
    common-tests.inc contain a query whose results were not properly deduplicated
    before, but are now, and while this was hidden by LIMIT/OFFSET, it affects
    which rows are visible in the result set.
    
    sysbench sorting tests (ranges and distinct ranges) show strong improvements
    at high thread counts; as much as +17%. Lower thread counts are neutral or
    in the noise.
    
    Unfortunately, replication started using Field::make_sort_key() in 8.0, and
    cannot easily change it back, as they need exact byte-by-byte matches of the
    data. Fixing this would enable removing 500+ lines of complicated sort key
    code.
    
    Change-Id: Ieb5038e8afbea19a5f0e0e7f83b3177cb3176e84
Loading