summaryrefslogtreecommitdiff
path: root/sql/sql_analyze_stmt.h
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-03-10 04:56:38 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-03-10 04:56:38 +0530
commit1ee8a02307951667874153361d54960cd568efe5 (patch)
treeb37e4d1d9b546dbe5f8bcdecee8b323e517fb336 /sql/sql_analyze_stmt.h
parent980108ceebdca5c4f6c9e3a167e9ad40cb062ac8 (diff)
downloadmariadb-git-bb-10.5-mdev6915-ext.tar.gz
MDEV-21580: Allow packed sort keys in sort bufferbb-10.5-mdev6915-ext
This task deals with packing the sort key inside the sort buffer, which would lead to efficient usage of the memory allocated for the sort buffer. The changes brought by this feature are 1) Sort buffers would have sort keys of variable length 2) The format for sort keys inside the sort buffer would look like |<sort_length><null_byte><key_part1><null_byte><key_part2>.......| sort_length is the extra bytes that are required to store the variable length of a sort key. 3) When packing of sort key is done we store the ORIGINAL VALUES inside the sort buffer and not the STRXFRM form (mem-comparable sort keys). 4) Special comparison function packed_keys_comparison() is introduced to compare 2 sort keys.
Diffstat (limited to 'sql/sql_analyze_stmt.h')
-rw-r--r--sql/sql_analyze_stmt.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sql_analyze_stmt.h b/sql/sql_analyze_stmt.h
index dfe29517b63..bc7c60a318b 100644
--- a/sql/sql_analyze_stmt.h
+++ b/sql/sql_analyze_stmt.h
@@ -223,7 +223,8 @@ public:
sort_passes(0),
sort_buffer_size(0),
r_using_addons(false),
- r_packed_addon_fields(false)
+ r_packed_addon_fields(false),
+ r_sort_keys_packed(false)
{}
/* Functions that filesort uses to report various things about its execution */
@@ -271,6 +272,10 @@ public:
r_using_addons= true;
r_packed_addon_fields= addons_packed;
}
+ inline void report_sort_keys_format(bool sort_keys_packed)
+ {
+ r_sort_keys_packed= sort_keys_packed;
+ }
void get_data_format(String *str);
@@ -334,6 +339,7 @@ private:
ulonglong sort_buffer_size;
bool r_using_addons;
bool r_packed_addon_fields;
+ bool r_sort_keys_packed;
};