因为vps问题 数据库崩溃了 不明原因直接丢失了
不过发现的问题在这里求高手解答一下先数据库结构是这样的
`id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(1000) DEFAULT '',
  `mastertype` varchar(50) DEFAULT '',
  `type` varchar(50) DEFAULT '',
  `poster` varchar(300) DEFAULT '',
  `createtime` int(11) DEFAULT '0',
  `lasttime` int(11) DEFAULT '0',
  `hits` int(11) DEFAULT '0',
  `gut` text,
  `come` varchar(300) DEFAULT '',
  PRIMARY KEY (`id`),
  KEY `lasttimeindex` (`lasttime`) USING BTREE,
  KEY `mastertypeindex` (`mastertype`) USING BTREE,
  KEY `typeindex` (`type`) USING BTREE,
  KEY `hitsindex` (`hits`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;当数据量不大的时候 因为我有4个索引   当用hits索引来使用的时候貌似在40W数据的时候也还是很快 还有id一样
当是当我用lasttime来索引的时候发现超级慢  lasttime是int类型  是时间戳格式的  这个大概会是什么原因造成呢 
是和lasttime的长度大小有关系 hits也是int 貌似就很快如果需要具体的数据 等我服务器重新架设好后explain

解决方案 »

  1.   

    你的lasttime的查询方式是怎么样的还有最好贴出explain 
      

  2.   

    现在是没法帖explain  我把sql给你看下 就是很简单的   因为我看过explain了 key是有的lasttimeindex    key_len 好像是5
    select * from ys_films order by lasttime desc limit xxx,20
      

  3.   

    这样快不快 select id from ys_films order by lasttime desc limit xxx,20
      

  4.   

    1.explain select id from ys_films order by lasttime desc limit 400000,20;
    +----+-------------+----------+-------+---------------+---------------+---------+------+--------+-------+
    | id | select_type | table    | type  | possible_keys | key           | key_len | ref  | rows   | Extra |
    +----+-------------+----------+-------+---------------+---------------+---------+------+--------+-------+
    |  1 | SIMPLE      | ys_films | index | NULL          | lasttimeindex | 5       | NULL | 400020 |       |
    +----+-------------+----------+-------+---------------+---------------+---------+------+--------+-------+
    貌似是起到作用了  卡住 是我取的台后面的数据 所以要检索40w开始后的20条 就很慢 这个问题如何解决 2.
    explain select * from ys_films where title like '%中英文%' limit 10;
    +----+-------------+----------+------+---------------+------+---------+------+--------+-------------+
    | id | select_type | table    | type | possible_keys | key  | key_len | ref  | rows   | Extra       |
    +----+-------------+----------+------+---------------+------+---------+------+--------+-------------+
    |  1 | SIMPLE      | ys_films | ALL  | NULL          | NULL | NULL    | NULL | 431696 | Using where |
    +----+-------------+----------+------+---------------+------+---------+------+--------+-------------+40万的数据 用like %中英文% 来检索如何提高效率  如果like %中英文%这样的方式没法提交性能和效率 是否是要用中文的全文检索   有什么好的推荐的中文的全文检索 对服务器要求高吗 希望高手解答  或者直接Q我帮下我  万分感谢啊
      

  5.   

    like %中英文%唯一的方法就是 全文检索