上一次修改时间:2015-11-26 18:11:52

待解决mysql问题

  1. 查找id小于201的记录时,mysql会改为全表扫描,查询时间约1min

    #说明:test1表中只有两个字段,自增的主键id,varchar(10)的title,表中存有9千5百万条记录,存储引擎为InnoDB;

  2. mysql> explain select title from test1 where id<201\G
    *************************** 1. row ***************************
               id: 1
      select_type: SIMPLE
            table: test1
             type: ALL
    possible_keys: PRIMARY,id
              key: NULL
          key_len: NULL
              ref: NULL
             rows: 1
            Extra: Using where
    1 row in set (0.11 sec)