- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有 max_join_size = 300M 的 MariaDB 10.4.14 和里面有大约 150,000 条记录的硬币 InnoDB 表。
一个足够简单的查询会产生 MAX_JOIN_SIZE 错误:
SELECT * FROM coin z -- USE INDEX(PRIMARY)
WHERE z.id IN (5510, 5511, 5512 /* more item IDs up to 250 */)
AND z.currency_id IN (8, 227)
AND z.distribution_id IN (1, 2);
Error Code: 1104
The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
但是带有索引提示的相同查询效果很好。命中 ["PRIMARY", "currency_id_idx", "distribution_id"] 甚至 issue_date_idx 中的索引并不重要即使根本没有索引 USE INDEX() 也能正常工作。
这里可能有什么问题?为什么查询在没有提示的情况下不起作用?
顺便说一句,此查询在 MariaDB 10.3.24 上运行良好,但在 10.5.5 上运行不佳
OPTIMIZE TABLE coin; -- didn't help
Table DDL and query EXPLAIN
CREATE TABLE `coin` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(90) NOT NULL DEFAULT '',
`country_id` smallint(5) unsigned NOT NULL DEFAULT 0,
`currency_id` smallint(5) unsigned NOT NULL DEFAULT 0,
`distribution_id` tinyint(3) unsigned NOT NULL,
`issue_date` date NOT NULL DEFAULT '0000-00-00',
-- and other, total 29 fields
PRIMARY KEY (`id`),
KEY `issue_date_idx` (`issue_date`),
KEY `currency_id_idx` (`currency_id`),
KEY `distribution_id` (`distribution_id`),
-- and other, total 21 indices for other fields which don't use currency_id or distribution_id
CONSTRAINT `coin_ibfk_4` FOREIGN KEY (`currency_id`) REFERENCES `currency` (`id`),
CONSTRAINT `coin_ibfk_11` FOREIGN KEY (`distribution_id`) REFERENCES `distribution` (`id`),
-- and other, total 13 CONSTRAINTs
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
EXPLAIN FORMAT=JSON -- for SELECT above without index hint
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "z",
"access_type": "range",
"possible_keys": ["PRIMARY", "currency_id_idx", "distribution_id"],
"key": "PRIMARY",
"key_length": "3",
"used_key_parts": ["id"],
"rows": 50,
"filtered": 100,
"attached_condition": "z.`id` in (5510,5511,5512, /* ... total 100 */) and z.currency_id in (8,227) and z.distribution_id in (1,2)"
}
}
}
上面的 SELECT 在没有索引提示的情况下使用最大可能的 MAX_JOIN_SIZE 值并且不使用最大值 - 1:
SET MAX_JOIN_SIZE=18446744073709551615 -- this works
SET MAX_JOIN_SIZE=18446744073709551614 -- this doesn't work
最佳答案
可以通过恢复以前的默认值来修复 MAX_JOIN_SIZE 错误
optimizer_use_condition_selectivity = 1 # new default is 4 since 10.4.1
关于mariadb-10.4 - 没有索引提示的 MariaDB MAX_JOIN_SIZE 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64085913/
我正在为我本地的足球队制作一个网站,我想在一个页面上显示每个团队成员的一些简单数据(场上位置、比赛次数、进球数等)。我尝试通过对数据库的一次查询来选择所有需要的数据,因为我了解到最大限度地减少网络调用
我有两张 table 。一个是记录调用的调用历史表(开始时间、结束时间、电话号码、用户等)。另一个是记录订单详细信息(订单号、客户信息、订单日期等)的订单表。创建调用时并不总是创建订单,因此没有保证的
我代表遇到此问题的一小部分用户问这个问题。 一旦他们使用的脚本获得第 21 个 ID,就会生成以下错误: The SELECT would examine more than MAX_JOIN_SIZ
我运行此查询: SELECT u.user_id, u.fname, u.lname, n.title, n.news_id, n.post, n.zip, z.city,z.state_abbr F
我们正在连接 3 个表,分别包含约 21000 行、约 2000 行和约 1600 行。 MAX_JOIN_SIZE 约为 8.000.000。每个表都包含一个名为providerID 的列。 查询如
当运行一个连接来自 3 个大表的数据的查询时,我收到一条错误消息 The SELECT would examine more than MAX_JOIN_SIZE rows; check you
我开发了一个考勤管理系统,我想通过运行以下查询来生成报告,这将是大量的行,我在共享主机上并收到以下错误: 查询: SELECT `attendance`.*, `users`.`id` AS use
我有一个 SQL 查询失败(大部分时间),因为连接的行太多。 MySQL 提供的错误是 The SELECT would examine more than MAX_JOIN_SIZE rows;检查
我正在使用 PHP 和 MySQL。在我的程序中有一个涉及连接的选择查询。当我在本地主机上运行它时它工作正常但是当我将它上传到我的服务器并尝试执行它时它会生成以下错误: SELECT 将检查超过 MA
有 max_join_size = 300M 的 MariaDB 10.4.14 和里面有大约 150,000 条记录的硬币 InnoDB 表。 一个足够简单的查询会产生 MAX_JOIN_SIZE
当我将 cakephp v3 应用程序部署到共享主机时,出现以下 MAX_JOIN_SIZE 错误: Error: SQLSTATE[42000]: Syntax error or acces
我正在使用 MySQLi Procedural 从 MYSQL 数据库运行查询。我只看到这是如何使用 MySQLi 面向对象代码完成的。 它在本地主机上完美运行,但在远程服务器上我收到一条错误消息,指
我有一个小型非营利组织的捐助者和门票销售信息数据库。我正在尝试根据捐赠、购买季票或购买单程票的人快速导出邮件列表。 “entity”表是联系信息等,然后其他表包含有关捐赠的信息(年份、金额、支票日期等
我的查询遇到了问题...... SELECT keywords.keyword, keywords.keyid, sources.s_title, sources.s_disc, sources.s_
Exception -> string(69) "SQLSTATE[HY000]: General error: 1193 Unknown system variable 'OPTION'" Exce
我是一名优秀的程序员,十分优秀!