diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-10-26 13:10:44 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-10-26 13:10:44 +0530 |
commit | 3e4f207c5c0aad0419857da7ed8f4f4204657f85 (patch) | |
tree | 832cc984e18d326e6aa3e7695387575081fe0983 /sql/filesort.cc | |
parent | 8dea733c537622b8e69eeb36d1726a3f808051eb (diff) | |
download | mariadb-git-10.5-varun.tar.gz |
Followup fix10.5-varun
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r-- | sql/filesort.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index 70926d7d449..40db6e0070a 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -2199,7 +2199,11 @@ sortlength(THD *thd, Sort_keys *sort_keys, bool *allow_packing_for_sortkeys) length=0; uint nullable_cols=0; - sort_keys->reset_parameters(); + if (!sort_keys->is_first_execution()) + { + *allow_packing_for_sortkeys= sort_keys->using_packed_sortkeys(); + return sort_keys->get_sort_length_with_memcmp_values(); + } for (SORT_FIELD *sortorder= sort_keys->begin(); sortorder != sort_keys->end(); @@ -2262,6 +2266,8 @@ sortlength(THD *thd, Sort_keys *sort_keys, bool *allow_packing_for_sortkeys) // add bytes for nullable_cols sort_keys->increment_original_sort_length(nullable_cols); *allow_packing_for_sortkeys= allow_packing_for_keys; + sort_keys->set_sort_length_with_memcmp_values(length + nullable_cols); + sort_keys->set_first_execution(false); DBUG_PRINT("info",("sort_length: %d",length)); return length + nullable_cols; } @@ -2520,7 +2526,7 @@ void Sort_param::try_to_pack_sortkeys() return; const uint sz= Sort_keys::size_of_length_field; - uint sort_len= sort_keys->get_sort_length(); + uint sort_len= sort_keys->get_sort_length_with_original_values(); /* Heuristic introduced, skip packing sort keys if saving less than 128 bytes |