summaryrefslogtreecommitdiff
path: root/sql/sql_string.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2021-10-19 13:17:11 +0400
committerAlexander Barkov <bar@mariadb.com>2021-10-22 13:52:52 +0400
commitd2427bc0f5339cef7e6ca831d859780f248ed649 (patch)
tree89691ef56966101e649d21d57ab41ec930def769 /sql/sql_string.h
parent5cfb31854a4b28385d7e4940f297616042b0f345 (diff)
downloadmariadb-git-bb-10.7-bar-uuid.tar.gz
MDEV-26664 Store UUIDs in a more efficient mannerbb-10.7-bar-uuid
UUID values llllllll-mmmm-Vhhh-vsss-nnnnnnnnnnnn are now stored as nnnnnnnnnnnn-vsss-Vhhh-mmmm-llllllll inside the record: - the groups (segments separated by dash) are reordered right-to-left. - the bytes inside the groups are not reordered (stored as before, in big-endian format). This provides a better sorting order: the earlier UUID was generated, the higher it appears in the ORDER BY output. Also, this change enables a good key prefix compression, because the constant part is now in the beginning, while the non-constant part (the timestamp) is in the end.
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r--sql/sql_string.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h
index fe57c8153bb..795f80c3e08 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -484,6 +484,11 @@ public:
if (str.Alloced_length)
Alloced_length= (uint32) (str.Alloced_length - offset);
}
+ LEX_CSTRING to_lex_cstring() const
+ {
+ LEX_CSTRING tmp= {Ptr, str_length};
+ return tmp;
+ }
inline LEX_CSTRING *get_value(LEX_CSTRING *res)
{
res->str= Ptr;