MariaDB 11.1.0 预览版现已推出
MariaDB 11.1.0 预览版现已推出。值得注意的是,预览版旨在更快地将功能交到用户手中,不应用于生产。预览版中的功能可能不会全部发布为普遍可用 (GA) 版本,只有那些通过测试的功能才会合并到 MariaDB Server 11.1.1 中。
11.1 正在考虑的功能包括:
YEAR 和 DATE 的索引用法
使用 MDEV-8320 时,一些使用 DATE 或 YEAR 函数的查询会快得多,因为优化器现在可以在某些情况下使用索引。采用以下方法(从创建包含 1000 个日期的表 t3 开始)。
create table t0(a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1(a int); insert into t1 select A.a + B.a* 10 from t0 A, t0 B; create table t2 (pk int primary key, a datetime, b date, key(a), key(b)); insert into t2 select A.a*10+B.a, date_add(date_add('2017-01-01', interval A.a*8 day), interval B.a hour), date_add('2017-01-01', interval A.a*7 day) from t1 A, t0 B; SELECT * FROM t2 LIMIT 3; +----+---------------------+------------+ | pk | a | b | +----+---------------------+------------+ | 0 | 2017-01-01 00:00:00 | 2017-01-01 | | 1 | 2017-01-01 01:00:00 | 2017-01-01 | | 2 | 2017-01-01 02:00:00 | 2017-01-01 | ... | 997 | 2019-03-04 07:00:00 | 2018-11-25 | | 998 | 2019-03-04 08:00:00 | 2018-11-25 | | 999 | 2019-03-04 09:00:00 | 2018-11-25 | +-----+---------------------+------------+ explain select * from t2 where date(a) <= '2017-01-01'\G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: t2 type: range possible_keys: a key: a key_len: 6 ref: NULL rows: 10 Extra: Using index condition
直到 MariaDB 11.0,优化器才会使用索引:
explain select * from t2 where date(a) <= '2017-01-01'\G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: t2 type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 1000 Extra: Using where
索引可以与 YEAR 和 DATE 函数一起使用,也可以与任何 >、<、>=、<= 或 = 运算符一起使用:
explain select * from t2 where year(a) < 2017\G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: t2 type: range possible_keys: a key: a key_len: 6 ref: NULL rows: 1 Extra: Using index condition explain select * from t2 where year(a) = 2019\G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: t2 type: range possible_keys: a key: a key_len: 6 ref: NULL rows: 80 Extra: Using index condition
UPDATE/DELETE 的半连接优化
MariaDB 有很多半连接优化。以前,单表 UPDATE/DELETE 语句无法利用这些,因为半连接优化是一种不能用于单表 UPDATE/DELETE 的子查询优化。现在,优化器可以自动将单表 UPDATE 和 DELETE 转换为多表 UPDATE/DELETE,从而为它们启用半连接优化。如果你在 UPDATE 或 DELETE 中使用子查询,这些语句可能会快得多(MDEV-7487 ) 例如,比较样本数据集中的这两个 EXPLAIN 结果。首先,在 MariaDB 11.1 之前:
explain delete from partsupp where (ps_partkey, ps_suppkey) in (select p_partkey, s_suppkey from part, supplier where p_retailprice between 901 and 910 and s_nationkey in (select n_nationkey from nation where n_name='PERU'))\G *************************** 1. row *************************** id: 1 select_type: PRIMARY table: partsupp type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 700 Extra: Using where *************************** 2. row *************************** id: 2 select_type: DEPENDENT SUBQUERY table: nation type: ref possible_keys: PRIMARY,i_n_regionkey,i_n_name key: i_n_name key_len: 26 ref: const rows: 1 Extra: Using where; Using index *************************** 3. row *************************** id: 2 select_type: DEPENDENT SUBQUERY table: part type: eq_ref possible_keys: PRIMARY key: PRIMARY key_len: 4 ref: func rows: 1 Extra: Using where *************************** 4. row *************************** id: 2 select_type: DEPENDENT SUBQUERY table: supplier type: eq_ref possible_keys: PRIMARY,i_s_nationkey key: PRIMARY key_len: 4 ref: func rows: 1 Extra: Using where
然后,MariaDB 11.1 EXPLAIN 的等效查询:
explain delete from partsupp where (ps_partkey, ps_suppkey) in (select p_partkey, s_suppkey from part, supplier where p_retailprice between 901 and 910 and s_nationkey in (select n_nationkey from nation where n_name='PERU'))\G *************************** 1. row *************************** id: 1 select_type: PRIMARY table: nation type: ref possible_keys: PRIMARY,i_n_name key: i_n_name key_len: 26 ref: const rows: 1 Extra: Using where; Using index *************************** 2. row *************************** id: 1 select_type: PRIMARY table: supplier type: ref possible_keys: PRIMARY,i_s_nationkey key: i_s_nationkey key_len: 5 ref: test.nation.n_nationkey rows: 1 Extra: Using index *************************** 3. row *************************** id: 1 select_type: PRIMARY table: partsupp type: ref possible_keys: PRIMARY,i_ps_partkey,i_ps_suppkey key: i_ps_suppkey key_len: 4 ref: test.supplier.s_suppkey rows: 1 Extra: *************************** 4. row *************************** id: 1 select_type: PRIMARY table: part type: eq_ref possible_keys: PRIMARY key: PRIMARY key_len: 4 ref: test.partsupp.ps_partkey rows: 1 Extra: Using where
JSON 模式验证
JSON_SCHEMA_VALID 函数已根据 JSON Schema Draft 2020 实现 ( MDEV-27128 ) 。如果给定的 json 对模式有效,则该函数返回 true,否则返回 false。
SET @schema= '{ "properties" : { "number1":{ "maximum":10 }, "string1" : { "maxLength": 3} } }'; SELECT JSON_SCHEMA_VALID(@schema, '{ "number1":25, "string1":"ab" }'); +----------------------------------------------------------------+ | JSON_SCHEMA_VALID(@schema, '{ "number1":25, "string1":"ab" }') | +----------------------------------------------------------------+ | 0 | +----------------------------------------------------------------+ SELECT JSON_SCHEMA_VALID(@schema, '{ "number1":10, "string1":"ab" }'); +----------------------------------------------------------------+ | JSON_SCHEMA_VALID(@schema, '{ "number1":10, "string1":"ab" }') | +----------------------------------------------------------------+ | 1 | +----------------------------------------------------------------+
InnoDB defragmentation
InnoDB defragmentation 是一个很少使用的功能,它使 OPTIMIZE TABLE 不会像往常一样重建表,而是导致索引 B-trees 就地优化。但是,该选项使用了过多的锁定(独占锁定索引树),从未覆盖 SPATIAL INDEXes 或 FULLTEXT INDEXes,并且从未回收存储空间。由于它不是特别有用,在很多情况下不起作用,并且造成维护负担,它已被删除(MDEV-30545)。
其他特性
- MDEV-16329 ALTER ONLINE TABLE 已在存储引擎层之上实现,模仿了自 MariaDB 10.0 以来 InnoDB 所做的工作。
- Mariabackup 是用于执行物理在线备份的工具。它最初是 Xtrabackup 的一个分支,不支持 MariaDB 10.1 的静态数据加密。然而,文件仍然被命名为
xtrabackup_*
. 它们现在被命名为mariadb_backup_*
( MDEV-18931 )
链接

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
Jetpack Compose 1.4 发布,构建原生 Android 界面的工具包
Jetpack Compose 1.4 已正式发布,新版本引入了分页工具 Pager,以及更灵活的 Flow 布局。同时为开发者提供配置文字样式的新方法,加入连字符号 (Hyphenation) 和换行 (Line-Break) 等。 Jetpack Compose 是官方推荐用于构建原生 Android 界面的新工具包。它可简化并加快 Android 上的界面开发,使用更少的代码、强大的工具和直观的 Kotlin API,快速打造生动而精彩的应用。 分页功能 Pager & Flow 布局 Jetpack Compose 现在能够让开发者方便地创建垂直分页和水平分页,以便用户在屏幕上左右滑动就能够快速切换不同内容分页(如下图)。 而 Flow 布局则提供了一个新的内容折叠方法,当空间不足时,Flow 布局允许内容折叠至下一列或下一行。 此外,Jetpack Compose 1.4 还改进了 Text 和 TextField 的灵活性,除了修复错误、支持新的表情符号外,还解决了 TextField 长期存在的问题。 此前在特定情况下,可滚动 Column 或 LazyColum...
- 下一篇
JeeSite Vue 4.6.2 发布,Spring Boot 快速开发平台
升级内容 升级 spring boot 2.7.10 增加 子表初始非编辑状态,点击行再编辑的存储例子 优化 展开当前级别树表时,加载框显示1次,不频闪了 优化 内容管理网站主题,细节风格美化。 优化 列表查询,点击重置按钮后即查询 优化 分页输入框显示样式,分页参数容错 优化 表格分页的输入框宽度,根据输入页码自适应 优化 右上角消息太多时,有时文字溢出的样式 修正 非黑暗模式下,登录页的页签 hover 黑色的问题 修正 jqgrid custom_value 的提示信息不正确问题 修正 CMS 文字扩展字段不能保存问题 #I6IBXO 修正 CMS CmsUtils.getArticleList 的 isQueryArticleData 参数不生效问题 #I6HN74 修正 CAS中央认证服务退出后,没有退出客户端的问题 升级 JeeSite Cloud 社区版,可以商用。 升级 可视化数据大屏 v2.5 升级方法 修改pom.xml文件中的jeesite-parent版本号为4.6.2-SNAPSHOT 如果你修改了parent、common、core项目源码,请与git上的代...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- CentOS8,CentOS7,CentOS6编译安装Redis5.0.7
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- CentOS7编译安装Gcc9.2.0,解决mysql等软件编译问题
- Mario游戏-低调大师作品
- CentOS7,8上快速安装Gitea,搭建Git服务器
- CentOS6,7,8上安装Nginx,支持https2.0的开启
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果
- Linux系统CentOS6、CentOS7手动修改IP地址
- CentOS关闭SELinux安全模块
- CentOS8安装Docker,最新的服务器搭配容器使用