1

升级到 mariadb 10.5.11 后,我遇到了一个奇怪的索引问题。

具有两列Type(varchar) 和Point(point)的简单表

(Tindex)上的索引和( TypePindex) 上的空间索引Point

现在像这样的查询

SELECT X(Point) as x,Y(Point) as y,hotels.Type FROM hotels WHERE (Type in ("acco")) AND MBRContains( GeomFromText( 'LINESTRING(4.922 52.909,5.625 52.483)' ), hotels.Point)
;

结果是

查询错误 (1207):在 READ UNCOMMITTED 事务期间无法获取更新锁

虽然两者

SELECT X(Point) as x,Y(Point) as y,hotels.Type FROM hotels USE INDEX (Pindex) WHERE (Type in ("acco")) AND MBRContains( GeomFromText( 'LINESTRING(4.922 52.909,5.625 52.483)' ), hotels.Point)
;

SELECT X(Point) as x,Y(Point) as y,hotels.Type FROM hotels USE INDEX (Tindex) WHERE (Type in ("acco")) AND MBRContains( GeomFromText( 'LINESTRING(4.922 52.909,5.625 52.483)' ), hotels.Point)
;

工作正常。正如 mariadb 10.5.10 所做的那样

| 编号 | 选择类型 | 表| 类型 | 可能的键 | 关键 | key_len | 参考 | 行 | 额外 |

| 1 | 简单 | 酒店 | 范围|过滤器 | 类型,Pindex | Pindex|类型 | 34|302 | 空 | 340 (4%) | 使用哪里;使用 rowid 过滤器 |

4

3 回答 3

1

该问题现在被跟踪为MDEV-26123(我猜你在那里报告了它)。问题描述说该问题是在 MariaDB 10.2.39、10.3.30、10.4.20、10.5.11、10.6.1 中引入的。

我在升级到 MariaDB 10.6.4 后遇到了这个问题。我降级到 10.6.0,无需进行任何数据迁移即可。现在似乎已经解决了这个问题。

于 2021-08-17T23:00:10.970 回答
0

造成这种情况的原因似乎是MDEV -25594的代码修复

我在提交消息或讨论中看不到任何表明对 READ UNCOMMITTED 行为的更改是故意的。

没有公开的错误报告,所以我建议您创建一个新的错误报告

于 2021-07-09T00:49:35.653 回答
0

选择@@session.autocommit;

设置@@session.autocommit=0;

选择@@session.autocommit;

#add in my.cnf autocommit = 0

使用 mariadb 10.2.40(已解决) https://developpaper.com/transaction-isolation-level-of-mariadb/

于 2022-01-27T15:34:56.510 回答