github.com/whtcorpsinc/milevadb-prod@v0.0.0-20211104133533-f57f4be3b597/dbs/cmd/benchdb/explaintest/t/access_path_selection.test (about)

     1  CREATE TABLE `access_path_selection` (
     2  `a` int,
     3  `b` int,
     4  KEY `IDX_a` (`a`),
     5  KEY `IDX_b` (`b`),
     6  KEY `IDX_ab` (`a`, `b`)
     7  );
     8  explain select a from access_path_selection where a < 3;
     9  # In this query, IDX_ab is better than IDX_a.
    10  # The reason is that we have to do double scan if we use IDX_a since it doesn't contain column b.
    11  explain select a, b from access_path_selection where a < 3;
    12  # In this query, IDX_ab can't be used, so IDX_b is the best.
    13  explain select a, b from access_path_selection where b < 3;
    14  explain select a, b from access_path_selection where a < 3 and b < 3;
    15  # _milevadb_rowid should also be considered as PK.
    16  explain select a, b from access_path_selection where a > 10 order by _milevadb_rowid;
    17  explain select max(_milevadb_rowid) from access_path_selection;
    18  # Use indexPath in this query.
    19  explain select count(1) from access_path_selection;