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

« back to all changes in this revision

Viewing changes to mysql-test/t/range.test

  • 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:
1313
1313
 
1314
1314
DROP TABLE t1;
1315
1315
 
 
1316
--echo #
 
1317
--echo # Bug#50939: Loose Index Scan unduly relies on engine to remember range 
 
1318
--echo # endpoints
 
1319
--echo #
 
1320
CREATE TABLE t1 (
 
1321
 a INT,
 
1322
 b INT,
 
1323
 KEY ( a, b )
 
1324
) PARTITION BY HASH (a) PARTITIONS 1;
 
1325
 
 
1326
CREATE TABLE t2 (
 
1327
 a INT,
 
1328
 b INT,
 
1329
 KEY ( a, b )
 
1330
);
 
1331
 
 
1332
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
 
1333
 
 
1334
INSERT INTO t1 SELECT a +  5, b +  5 FROM t1;
 
1335
INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
 
1336
INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
 
1337
INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
 
1338
 
 
1339
INSERT INTO t2 SELECT * FROM t1;
 
1340
 
 
1341
--echo # plans should be identical
 
1342
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
 
1343
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
 
1344
 
 
1345
FLUSH status;
 
1346
SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
 
1347
--echo # Should be no more than 4 reads.
 
1348
SHOW status LIKE 'handler_read_key';
 
1349
 
 
1350
FLUSH status;
 
1351
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
 
1352
--echo # Should be no more than 4 reads.
 
1353
SHOW status LIKE 'handler_read_key';
 
1354
 
 
1355
DROP TABLE t1, t2;
 
1356
 
1316
1357
--echo End of 5.1 tests