Skip to content

Commit 20bb4ed

Browse files
committed
make the heap.heap test portable
in HEAP btree indexes, the address of a record in memory is part of the key. So, when inserting many identical keys, the actual btree shape is defined by how and where records in memory are allocated. records_in_range uses floats to estimate the size of the chunk of the btree between min and max records, it depends on the btree shape and, thus, is not portable either. As are optimizer decisions that are based on records_in_range estimations, if the number happens to be close to a tipping point. as a fix, reduce the number of matching rows, so that even with system-specific variations the optimizer would still pick the expected plan. Fixes heap.heap failure (range vs ALL) on ppc64
1 parent 13e8f72 commit 20bb4ed

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

mysql-test/suite/heap/heap.result

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -563,32 +563,32 @@ t1 CREATE TABLE `t1` (
563563
) ENGINE=MEMORY DEFAULT CHARSET=latin1
564564
select count(*) from t1;
565565
count(*)
566-
270
566+
267
567567
insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
568568
select count(*) from t1 where v='a';
569569
count(*)
570-
10
570+
7
571571
select count(*) from t1 where c='a';
572572
count(*)
573-
10
573+
7
574574
select count(*) from t1 where t='a';
575575
count(*)
576-
10
576+
7
577577
select count(*) from t1 where v='a ';
578578
count(*)
579-
10
579+
7
580580
select count(*) from t1 where c='a ';
581581
count(*)
582-
10
582+
7
583583
select count(*) from t1 where t='a ';
584584
count(*)
585-
10
585+
7
586586
select count(*) from t1 where v between 'a' and 'a ';
587587
count(*)
588-
10
588+
7
589589
select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
590590
count(*)
591-
10
591+
7
592592
explain select count(*) from t1 where v='a ';
593593
id select_type table type possible_keys key key_len ref rows Extra
594594
1 SIMPLE t1 ref v v 13 const # Using where
@@ -618,9 +618,6 @@ qq
618618
*a *a*a *
619619
*a *a*a *
620620
*a *a*a *
621-
*a *a*a *
622-
*a *a*a *
623-
*a *a*a *
624621
explain select * from t1 where v='a';
625622
id select_type table type possible_keys key key_len ref rows Extra
626623
1 SIMPLE t1 ref v v 13 const # Using where

mysql-test/suite/heap/heap.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ while ($1)
337337
}
338338
dec $1;
339339
}
340+
delete from t1 where v like 'a%' and length(v) > 7;
340341
commit;
341342
--enable_query_log
342343
select count(*) from t1;

0 commit comments

Comments
 (0)