-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
tidb sql count bug #9125
Comments
@jiucaiProductions thanks for the report, we will fix this. I reproduced this issue on latest master branch. Here is the simplified reproduction step:
After auto analyze has been executed in background, plan generated would change to not push aggregation down to storage layer. Looks like the problem is caused by |
We've located the root cause of this problem. It will be fixed soon |
-- user default test db
use test;
select @@Version;
-- 5.7.10-TiDB-v2.1.0-5-g4dad722
CREATE TABLE
t1
(name
varchar(100) DEFAULT NULL);
insert into t1 (
name
) values ('test');-- return 0
SELECT COUNT(1)
FROM (
SELECT COUNT(1)
FROM (
SELECT *
FROM t1
WHERE name = 'test') t)
t2;
insert into t1 (
name
) values ('test2');-- return 1
SELECT COUNT(1)
FROM (
SELECT COUNT(1)
FROM (
SELECT *
FROM t1
WHERE name = 'test') t)
t2;
truncate table t1;
-- repeat above, the seconds count sql return 0;
The text was updated successfully, but these errors were encountered: