现有一表A,为分区表。
  字段如下
   id    number      primary(唯一索引)
   pid   varchar2    创建索引
   xxx   ...
   xxx   ...
   ...   ...     现在问题是这样,2条sql语句:
  1. select * from A partition(分区表名) where pid='xxx' order by lsh    //查询速度很慢很慢
  2. select * from A partition(分区表名) where pid='xxx'    // 不加order by lsh ,查询速度可以。我想问下为什么按lsh排序会这么慢。
  

解决方案 »

  1.   

    不好意思copy错了
    2条sql语句:
    1. select * from A partition(分区表名) where pid='xxx' order by id//查询速度很慢很慢
    2. select * from A partition(分区表名) where pid='xxx' // 不加order by id,查询速度可以。我想问下为什么按id排序会这么慢。
      

  2.   

    排序是要做比较的嘛  做比较就需要花时间啊 
    you know!
      

  3.   

    我用以下3条语句,速度都很快。
    select * from A partition(分区表名) where pid='xxx' order by pid
    select * from A partition(分区表名) where id='xxx' order by id
    select * from A partition(分区表名) where id='xxx' order by pid
    想问下,是不是与id的唯一索引有关系,或者是排序的时候,它是对整个大表操作的。
    谢谢