~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/r/range.result

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-21 15:31:05 UTC
  • mfrom: (1.1.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20100621153105-pbbz3t6nyrf9t2zq
Tags: upstream-5.1.48
ImportĀ upstreamĀ versionĀ 5.1.48

Show diffs side-by-side

added added

removed removed

Lines of Context:
1653
1653
0       0
1654
1654
1       1
1655
1655
DROP TABLE t1;
 
1656
#
 
1657
# Bug#50939: Loose Index Scan unduly relies on engine to remember range 
 
1658
# endpoints
 
1659
#
 
1660
CREATE TABLE t1 (
 
1661
a INT,
 
1662
b INT,
 
1663
KEY ( a, b )
 
1664
) PARTITION BY HASH (a) PARTITIONS 1;
 
1665
CREATE TABLE t2 (
 
1666
a INT,
 
1667
b INT,
 
1668
KEY ( a, b )
 
1669
);
 
1670
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
 
1671
INSERT INTO t1 SELECT a +  5, b +  5 FROM t1;
 
1672
INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
 
1673
INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
 
1674
INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
 
1675
INSERT INTO t2 SELECT * FROM t1;
 
1676
# plans should be identical
 
1677
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
 
1678
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
1679
1       SIMPLE  t1      range   a       a       5       NULL    1       Using where; Using index for group-by
 
1680
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
 
1681
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
1682
1       SIMPLE  t2      range   a       a       5       NULL    2       Using where; Using index for group-by
 
1683
FLUSH status;
 
1684
SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
 
1685
a       MAX(b)
 
1686
10      10
 
1687
# Should be no more than 4 reads.
 
1688
SHOW status LIKE 'handler_read_key';
 
1689
Variable_name   Value
 
1690
Handler_read_key        4
 
1691
FLUSH status;
 
1692
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
 
1693
a       MAX(b)
 
1694
10      10
 
1695
# Should be no more than 4 reads.
 
1696
SHOW status LIKE 'handler_read_key';
 
1697
Variable_name   Value
 
1698
Handler_read_key        4
 
1699
DROP TABLE t1, t2;
1656
1700
End of 5.1 tests