summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2020-08-22 15:22:20 +0400
committerAlexander Barkov <bar@mariadb.com>2020-08-22 15:22:20 +0400
commit2e5d86f49e7ee538806fba68dc8c960d6acdd483 (patch)
treeaec0e6903f5decc8c3cdd70111d845ca43e3120e /sql/field.h
parentae33ebe5b32a82629a40e51c8d6c6611842fbd03 (diff)
downloadmariadb-git-2e5d86f49e7ee538806fba68dc8c960d6acdd483.tar.gz
MDEV-23537 Comparison with temporal columns is slow in MariaDB
Implementing methods: - Field::val_time_packed() - Field::val_datetime_packed() - Item_field::val_datetime_packed(THD *thd); - Item_field::val_time_packed(THD *thd); to give a faster access to temporal packed longlong representation of a Field, which is used in temporal Arg_comparator's to DATE, TIME, DATETIME data types. The same idea is used in MySQL-5.6+. This improves performance.
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h
index 0ee4aca5f69..b3bc2d4dbea 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1401,6 +1401,8 @@ public:
void copy_from_tmp(int offset);
uint fill_cache_field(struct st_cache_field *copy);
virtual bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
+ virtual longlong val_datetime_packed(THD *thd);
+ virtual longlong val_time_packed(THD *thd);
virtual TYPELIB *get_typelib() const { return NULL; }
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
virtual CHARSET_INFO *charset_for_protocol(void) const
@@ -3167,6 +3169,7 @@ public:
void sql_type(String &str) const;
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
{ return Field_newdate::get_TIME(ltime, ptr, fuzzydate); }
+ longlong val_datetime_packed(THD *thd);
uint size_of() const { return sizeof(*this); }
Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item);
};
@@ -3336,6 +3339,7 @@ public:
}
int reset();
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate);
+ longlong val_time_packed(THD *thd);
int store_native(const Native &value);
bool val_native(Native *to);
uint size_of() const { return sizeof(*this); }
@@ -3495,6 +3499,7 @@ public:
int reset();
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
{ return Field_datetimef::get_TIME(ltime, ptr, fuzzydate); }
+ longlong val_datetime_packed(THD *thd);
uint size_of() const { return sizeof(*this); }
};