summaryrefslogtreecommitdiff
path: root/sql/sql_sort.h
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-03-28 12:31:22 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-12-04 23:38:09 +0530
commit202393086e4da6c6864778dcb87339f159ea48f6 (patch)
tree203cb33f02b64b59de11f86c56ba423f352ba0d2 /sql/sql_sort.h
parente9f33b7760539e2ba60fb236fab8eaf0ce53ca4a (diff)
downloadmariadb-git-bb-10.6-mdev21829.tar.gz
MDEV-21829: Use packed sort keys in Unique objectsbb-10.6-mdev21829
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.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/sql/sql_sort.h b/sql/sql_sort.h
index 3b23328183c..5a36f3b6f6a 100644
--- a/sql/sql_sort.h
+++ b/sql/sql_sort.h
@@ -324,6 +324,8 @@ public:
bool is_parameters_computed() { return parameters_computed; }
void set_parameters_computed(bool val) { parameters_computed= val; }
+ int compare_keys(uchar *a, uchar *b);
+ int compare_keys_for_single_arg(uchar *a, uchar *b);
static const uint size_of_length_field= 4;
@@ -596,8 +598,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;
}
@@ -607,6 +609,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)
@@ -688,6 +695,12 @@ public:
{
return m_packed_format;
}
+ void set_packed_format(bool val)
+ {
+ m_packed_format= val;
+ }
+
+ uint32 get_key_length_for_unique(uchar *to, uint size_of_dupl_count);
private:
uint m_packable_length;