1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Don't write rows in MyISAM tables when using count(distinct)

Don't read MyISAM header when running without locking
This commit is contained in:
monty@tik.mysql.fi
2001-05-23 02:40:46 +03:00
parent a3be64bfa5
commit 8685094e15
13 changed files with 87 additions and 39 deletions

View File

@@ -0,0 +1,31 @@
a b
1 2
2 3
3 5
4 5
5 5
6 6
7 7
8 9
FOUND_ROWS()
8
a b
1 2
FOUND_ROWS()
8
a b
8 9
FOUND_ROWS()
8
b
2
FOUND_ROWS()
6
b c
2 1
FOUND_ROWS()
6
a b a b
3 5 5 5
FOUND_ROWS()
8

View File

@@ -0,0 +1,20 @@
#
# Testing of found_rows()
#
drop table if exists t1;
create table t1 (a int not null auto_increment, b int not null, primary key(a));
insert into t1 (b) values (2),(3),(5),(5),(5),(6),(7),(9);
select SQL_CALC_FOUND_ROWS * from t1;
select found_rows();
select SQL_CALC_FOUND_ROWS * from t1 limit 1;
select found_rows();
select SQL_CALC_FOUND_ROWS * from t1 order by b desc limit 1;
select found_rows();
select SQL_CALC_FOUND_ROWS distinct b from t1 limit 1;
select found_rows();
select SQL_CALC_FOUND_ROWS b,count(*) as c from t1 group by b order by c limit 1;
select found_rows();
select SQL_CALC_FOUND_ROWS * from t1 left join t1 as t2 on (t1.b=t2.a) limit 2,1;
select found_rows();
drop table t1;