Closed hhyo closed 5 years ago
@liipx 另外一个Sampling data的错误
准备表结构和数据
create table soar_test(
id bigint unsigned primary key auto_increment,
v varchar(10) not null default ''
);
insert into soar_test (v)
values ('');
输入语句
select * from soar_test;
错误日志
2018/10/29 16:30:20.994 [D] [mysql.go:76] Execute SQL with DSN(127.0.0.1:3306/optimizer_osGC5MGrm3tl97k4) : CREATE TABLE `soar_test` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`v` varchar(10) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8
2018/10/29 16:30:21.020 [D] [env.go:397] createTable, Start Sampling data from archery.soar_test to optimizer_osGC5MGrm3tl97k4.soar_test ...
2018/10/29 16:30:21.025 [D] [mysql.go:76] Execute SQL with DSN(mysql:3306/archery) : show table status where name = 'soar_test'
2018/10/29 16:30:21.032 [D] [mysql.go:76] Execute SQL with DSN(mysql:3306/archery) : show table status where name = 'soar_test'
2018/10/29 16:30:21.039 [D] [sampling.go:99] SamplingData, tableRows: 1, wantRowsCount: 30000, factor: 30000.000000
2018/10/29 16:30:21.039 [D] [sampling.go:118] Sampling data execute: select DATA_TYPE from information_schema.COLUMNS where TABLE_SCHEMA='optimizer_osGC5MGrm3tl97k4' and TABLE_NAME = 'soar_test'
2018/10/29 16:30:21.046 [E] [sampling.go:227] doSampling Error from optimizer_osGC5MGrm3tl97k4.soar_test: Received #1048 error from MySQL server: "Column 'v' cannot be null"
2018/10/29 16:30:21.046 [D] [sampling.go:215] 1 rows sampling out
贴case的时候时候小心泄露隐私数据。
贴case的时候时候小心泄露隐私数据。
谢谢提醒,是特意准备的测试数据,库名也是开源的项目测试库。不过问一句wantRowsCount: 30000是可配置还是固定的。
wantRowsCount := 300 * common.Config.SamplingStatisticTarget
soar -h | grep -i sampling
-sampling-statistic-target int
SamplingStatisticTarget, 数据采样因子,对应postgres的default_statistics_target (default 100)
Received #1048 error from MySQL server: "Column 'v' cannot be null"
Sampling data会把空字符串转换成null?
两个case测试都正常,谢谢~
语句和数据信息(表结构上面的错误日志有)
配置信息和版本信息
./soar -print-config allow-online-as-test: false drop-test-temporary: true only-syntax-check: false sampling-statistic-target: 100 sampling: true profiling: false trace: false explain: true conn-time-out: 3 query-time-out: 30 delimiter: ; log-level: 7 log-output: /opt/archery/downloads/log/soar.log report-type: html report-css: "" report-javascript: "" report-title: SQL优化分析报告 markdown-extensions: 94 markdown-html-flags: 0 ignore-rules: