All pastes #174008 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-09-17 14:06 UTC
rendered paste body
mysql> explain SELECT DISTINCT pdatetime FROM hp1d ORDER BY pdatetime DESC LIMIT 2;
+----+-------------+-------+-------+---------------+---------+---------+------+----------+----------------------------------------------+
| id | select_type | table | type  | possible_keys | key     | key_len | ref  | rows     | Extra                                        |
+----+-------------+-------+-------+---------------+---------+---------+------+----------+----------------------------------------------+
|  1 | SIMPLE      | hp1d  | index | NULL          | PRIMARY |      13 | NULL | 15378685 | Using index; Using temporary; Using filesort |
+----+-------------+-------+-------+---------------+---------+---------+------+----------+----------------------------------------------+
1 row in set (0.01 sec)

mysql> explain SELECT DISTINCT pdatetime FROM hp1d ORDER BY pdatetime DESC LIMIT 2\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: hp1d
         type: index
possible_keys: NULL
          key: PRIMARY
      key_len: 13
          ref: NULL
         rows: 15378685
        Extra: Using index; Using temporary; Using filesort
1 row in set (0.00 sec)

mysql> show index from hp1d;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| hp1d  |          0 | PRIMARY  |            1 | sym         | A         |        NULL |     NULL | NULL   |      | BTREE      |         |
| hp1d  |          0 | PRIMARY  |            2 | pdatetime   | A         |    15378685 |     NULL | NULL   |      | BTREE      |         |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
2 rows in set (0.00 sec)

mysql> describe hp1d;
+-----------+----------------------+------+-----+------------+-------+
| Field     | Type                 | Null | Key | Default    | Extra |
+-----------+----------------------+------+-----+------------+-------+
| sym       | varchar(10)          |      | PRI |            |       |
| pdatetime | date                 |      | PRI | 0000-00-00 |       |
| val       | float(11,5) unsigned | YES  |     | NULL       |       |
+-----------+----------------------+------+-----+------------+-------+
8 rows in set (0.00 sec)