查看原文
其他

MySQL 9.0发布,号称支持向量(Vector),但我却看不懂Oracle到底在玩什么

YeJinrong/叶金荣 老叶茶馆 2024-07-08

我历来对这种每个大版本里的第一个小版本都不感冒,认为最多保持关注即可,无需大惊小怪。认真阅读新版本手册中的 What Is New 这部分内容,以及 release notes,了解新版本的动向及意图基本足矣。

但这次的MySQL 9.0发布,却激起了涟漪。

从昨晚开始,MySQL 圈就沸腾了,都在讨论9.0新版本。Oracle 官方 blog 推文里爆料即将新增 Vector 数据类型

New! Vector datatype 


Supported in CREATE and ALTER Statements

https://blogs.oracle.com/mysql/post/mysql-july-2024-ga-releases-now-available

看到有几位数据库圈大佬开始下载 9.0 版本并测试体验 Vector 新特性,甚至去翻了源码找到相应的 Vector 函数,真是太拼了,自叹弗如~

早早到公司,开始翻阅 MySQL 9.0 的用户手册,以及相应的 release notes,却大跌眼镜,傻眼了,在这两份重要文档中,没任何一处提到新增 Vector 数据类型,在用户手册数据类型部分,也确实没看到关于 Vector 的介绍。

Features Added or Changed in MySQL 9.0


The following features have been added to MySQL 9.0:

  • Saving JSON output from EXPLAIN ANALYZE INTO.  As of MySQL 9.0.0, support is now provided for saving JSON output from EXPLAIN ANALYZE into a user variable, using the synatx shown here:

    EXPLAIN ANALYZE FORMAT=JSON INTO @variable select_stmt

    The variable can be used subsequently as a JSON argument to any of MySQL's JSON functions (see Section 14.17, “JSON Functions”). The INTO clause is supported only with FORMAT=JSONFORMAT must be specified explicitly. This form of EXPLAIN ANALYZE also supports an optional FOR SCHEMA or FOR DATABASE clause.

    Note

    This feature is available only if the explain_json_format_version server system variable is set to 2; otherwise, attempting to make use of it raises ER_EXPLAIN_ANALYZE_JSON_FORMAT_VERSION_NOT_SUPPORTED (EXPLAIN ANALYZE does not support FORMAT=JSON with explain_json_format_version=1).

    See Obtaining Execution Plan Information, for additional information and examples.

  • Event DDL in prepared statements.  Beginning with MySQL 9.0.0, the following statements can be prepared:

    Positional parameters (? placeholders) are not supported for these statements; you must assemble the text of the statement to be prepared from some combination of string literals, system variables, and user variables. One way to accomplish this in a reusable fashion is to assemble the text of, for instance, a CREATE EVENT statement in the body of a stored procedure, passing any variable parts of the statement as IN parameters to the stored procedure; prepare the assembled text with PREPARE; invoke the procedure using the desired parameter values. See PREPARE, EXECUTE, and DEALLOCATE PREPARE Statements, and SQL Syntax Permitted in Prepared Statements, for more information. See Section 15.1.13, “CREATE EVENT Statement”, for an example.

    • CREATE EVENT

    • ALTER EVENT

    • DROP EVENT

  • Performance Schema system variable tables.  MySQL 9.0 add two new tables to the Performance Schema that provide information about server system variables. These tables are listed here:

    For more information, see Section 29.12.14, “Performance Schema System Variable Tables”.

    • The variables_metadata table provides general information about system variables. This information includes the name, scope, type, range (where applicable), and description of each system variable recognized by the MySQL server.

      Two of the columns in this table (MIN_VALUE and MAX_VALUE) are intended to replace deprecated columns of the variables_info table.

    • The global_variable_attributes table provides information about attribute-value pairs assigned by the server to global system variables.

以上内容出处:https://dev.mysql.com/doc/refman/9.0/en/mysql-nutshell.html

但是 MySQL 9.0 启动后也的确看到能已经支持 Vector。

搜索 MySQL 代码提交历史,也能看到相应的记录,看起来是准备将 MySQL Heatwave 也贡献出来的节奏,非常期待。

WL#16081 - Native Vector Embeddings Support In HeatWave

BUG#36165262 - WL#16081: Table is allowed to be partitioned on vector column 

BUG#36167088 - WL#16081: Generated columns allowed on vector columns 

BUG#36168511 - WL#16081: Issues with Vector column constraints 

BUG#36195637 - Wl16081: Alter table not giving error when new dimension less than existing data 

BUG#36194832 - WL#16081: STRING_TO_VECTOR function requires a vector type column 

BUG#36168535 - [Wl16081] Select Hangs whe VECTOR_TO_STRING called on vector column 

BUG#36206068 - [Wl16081] : Read-Replica broken with Vector data type 

BUG#36214076 - WL#16081: Rpdserver crash - sig11 at from_string_to_vector 

BUG#36225693 - WL#16081: Functions SHA1, MD5, SHA2 return error for vector data loaded to rapid 

BUG#36241312 - WL#16081: Error All plans were rejected by HeatWave secondary engine 

BUG#36255628 - WL#16081:setting secondary_engine of table having vector column taking long time 

BUG#36265079 - WL#16081: wrong result when IS NULL applied to distance() function output 

BUG#36272178 - WL#16081:virtual bool Item_func_get_user_var::propagate_type(THD*, const Type_properties&): Assertion false' failed. 

BUG#36239717 - to_base64() on vector column of miracl dataset crashes rapid 

BUG#36255777 - WL#16081: Mysqld crash - Assertion !std::isnan(nr)' failed. 


BUG#36281463 - STRING_TO_VECTOR() returning error "Data cannot be converted" 

BUG#36285521 - WL#16081: Mysqld crash - Assertion `!thd->is_error()' failed 

BUG#36287504 - WL#16081: mysqld crash at Item_func_to_vector::val_str for ASAN 

BUG#36267410 - WL#16081: mysqld crash at ParseBlob () in change_prop/rpd_binlog_parser.cc

This worklog will implement vector support in MySQL HeatWave.

ref: https://github.com/mysql/mysql-server/commit/8cd51511de7db36971954326af6d10eb7ac5476c

但用户手册和 release notes 里压根不提这些,这行为令我非常疑惑,Oracle 玩这一出到底是何用意呢,我可怜的 CPU 快烧坏了都没能想明白,亲爱的读者们,一起来讨论这是为啥呢




《深入浅出MGR》视频课程

戳此小程序即可直达B站






https://www.bilibili.com/medialist/play/1363850082?business=space_collection&business_id=343928&desc=0



文章推荐:





题图来自我的手机摄影

想看更多技术好文,点个“在看”

继续滑动看下一个
向上滑动看下一个

您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存