Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault #3

Open
wakaka2017 opened this issue Mar 10, 2017 · 13 comments
Open

Segmentation fault #3

wakaka2017 opened this issue Mar 10, 2017 · 13 comments

Comments

@wakaka2017
Copy link

1.OS version:CentOS release 6.5 (Final) MySQL version:5.7.16-log

2.error
2017-03-10 14:41:26 18622 [Note] 第1步: 对SQL解析优化之后得到的SQL:select count(1) AS COUNT(1) from (mydb.archive a left join mydb.archive_detail ad on((a.id = ad.archive_id))) where (a.user_id = 231)
2017-03-10 14:41:26 18622 [Note] 第2步:开始解析where中的条件:(a.user_id = 231)
2017-03-10 14:41:26 18622 [Note] show index from archive
2017-03-10 14:41:26 18622 [Note] show table status like 'archive'
2017-03-10 14:41:26 18622 [Note] select count(*) from ( select user_id from archive FORCE INDEX( PRIMARY ) order by id DESC limit 4) a where (a.user_id = 231)
2017-03-10 14:41:26 18622 [Note] 第3步:表archive的行数:9,limit行数:4,得到where条件中(a.user_id = 231)的选择度:4
2017-03-10 14:41:26 18622 [Note] 第4步:开始解析join on条件:a.id=ad.archive_id
2017-03-10 14:41:26 18622 [Note] 第5步:开始选择驱动表,一共有1个候选驱动表
2017-03-10 14:41:26 18622 [Note] explain select * from archive
Segmentation fault

3.table ddl
CREATE TABLE archive (
id bigint(20) NOT NULL AUTO_INCREMENT,
signed_summary_id bigint(20) DEFAULT NULL,
user_id bigint(20) DEFAULT NULL,
tilte varchar(200) DEFAULT NULL,
archive_type int(11) DEFAULT NULL,
archive_date date DEFAULT NULL,
created1 bigint(20) DEFAULT NULL,
created2 varchar(50) DEFAULT NULL,
created_date datetime DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=270 DEFAULT CHARSET=utf8mb4;

CREATE TABLE archive_detail (
id bigint(20) NOT NULL AUTO_INCREMENT,
archive_id bigint(20) DEFAULT NULL,
archive_type int(11) DEFAULT NULL,
archive_type_name varchar(20) DEFAULT NULL,
content varchar(2000) DEFAULT NULL,
pic varchar(200) DEFAULT NULL,
voice varchar(2000) DEFAULT NULL,
created_date datetime DEFAULT NULL,
service_remark int(5) DEFAULT '0',
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=420 DEFAULT CHARSET=utf8mb4;

@Zhifeiyu
Copy link

同问

@linmoyu
Copy link

linmoyu commented Apr 11, 2017

请问这个问题解决了吗, 我也碰到同样的问题

@pandakll
Copy link

关注这个问题

@imuse2012
Copy link

同问

@pandakll
Copy link

pandakll commented May 5, 2017

工具基于mysql5.7的bug吧,5.6没问题

@nbsky
Copy link

nbsky commented May 21, 2017

同5.7也出现了

@empo007
Copy link

empo007 commented Dec 5, 2017

这个问题我简单修改下代码可以不出现这个错误了:

把322行左右的下面文本:
if ((row = mysql_fetch_row(result))) {
result_set_count = atoi(row[EXPLAIN_ROWS]);
}
修改为:
if ((row = mysql_fetch_row(result))) {
if (row[EXPLAIN_ROWS]!=NULL) {
result_set_count = atoi(row[EXPLAIN_ROWS]);
}
}

@leiyifang
Copy link

leiyifang commented Dec 5, 2017 via email

@jpfss
Copy link

jpfss commented Jan 9, 2018

关注这个问题

@jpfss
Copy link

jpfss commented Jan 9, 2018

修改哪个文件?

@shihuizhen
Copy link

出现这个问题是因为mysql 5.7 的执行计划默认返回的字段和5.7 以前的不同。工具不能正常判断出执行计划范围的影响行数,所以报错。按照empo007 的方法改,虽然不出错了,但是也失去了针对join的进一步分析的功能。

@jakehu
Copy link

jakehu commented May 19, 2018

同样出现错误,持续关注中。Mysql环境 5.7

hhyo added a commit to hhyo/SQLAdvisor that referenced this issue Dec 8, 2018
hhyo added a commit to hhyo/SQLAdvisor that referenced this issue Dec 8, 2018
@dev-zhangchenxi
Copy link

同出现此问题 mysql5.7 上面改代码的方式验证有效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests