diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-03-28 12:31:22 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-06-29 14:04:07 +0530 |
commit | 077b71e4e5e5ad4aa2b4a7f6a1b49d457f5ceb55 (patch) | |
tree | c4a09ebb32e662a1243c23601ab6bd65a321668f /sql/sql_sort.h | |
parent | ead98fe5d34912578445d42e620c8ed95df4c433 (diff) | |
download | mariadb-git-10.5-varun2.tar.gz |
MDEV-21829: Use packed sort keys in Unique objects10.5-varun2
The task deals with packing the values stored in the Unique tree for each record.
The changes brought by this feature is:
1) Unique tree can have dynamic length keys
2) Format of keys looks like
<key_length> <packed_value1> <packed_value2> ....... <packed_valueN>
Unique class is currently used in
1) agg_func(DISTINCT col)
Here most aggregate functions like SUM, AVG accept only fixed size arguments
so it is not beneficial to use packing for these. Packing is done for
COUNT and GROUP_CONCAT (or JSON_ARRAYAGG) aggregate function as these are meaningful
2) index-merge stores row-ids
index merge stores row-ids which are of fixed size, so packing is not required
3) Engine Independent Table statistics
Packing is done here for variable length data types
This task is an extension to MDEV-21580.
Diffstat (limited to 'sql/sql_sort.h')
-rw-r--r-- | sql/sql_sort.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sql/sql_sort.h b/sql/sql_sort.h index 40f0c5ede5f..d512a9727b6 100644 --- a/sql/sql_sort.h +++ b/sql/sql_sort.h @@ -310,6 +310,8 @@ public: sort_length+= len; } + int compare_keys(uchar *a, uchar *b); + static const uint size_of_length_field= 4; private: @@ -567,8 +569,8 @@ public: bool using_packed_sortkeys() const { - DBUG_ASSERT(m_using_packed_sortkeys == - (sort_keys != NULL && sort_keys->using_packed_sortkeys())); + DBUG_ASSERT(sort_keys == NULL || + (m_using_packed_sortkeys == sort_keys->using_packed_sortkeys())); return m_using_packed_sortkeys; } @@ -578,6 +580,11 @@ public: return addon_fields != NULL; } + void set_using_packed_keys(bool val) + { + m_using_packed_sortkeys= val; + } + uint32 get_result_length(uchar *plen) { if (!m_using_packed_addons) @@ -659,6 +666,12 @@ public: { return m_packed_format; } + void set_packed_format(bool val) + { + m_packed_format= val; + } + + uint32 get_record_length_for_unique(uchar *to, uint size_of_dupl_count); private: uint m_packable_length; |