select count(1) from test where msg_time < to_date('2010-04-25', 'yyyy-mm-dd');count(1)
--------
     0select count(1) from test partition(sys_p101) where msg_time < to_date('2010-04-25', 'yyyy-mm-dd');count(1)
--------
     78954为什么第一次查询数据为0,而第二次查询有数据呢? 难道有partition 的数据查询必须指定 partition 才能查询?

解决方案 »

  1.   


    第一结果不应该为0.  楼主不要count, 查具体的一个列看一下select * from test where msg_time < to_date('2010-04-25', 'yyyy-mm-dd');
    select * from test partition(sys_p101) where msg_time < to_date('2010-04-25', 'yyyy-mm-dd');
    ------------------------------------------------------------------------------ 
    Blog: http://blog.csdn.net/tianlesoftware 
    网上资源: http://tianlesoftware.download.csdn.net 
    相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx 
    DBA1 群:62697716(满); DBA2 群:62697977
      

  2.   

    谢谢路上的,为什么count(1) 不对呢?
      

  3.   


    分区表有多大呢? 查询的时候有没有其他的操作。 不应该出现楼主遇见的这种情况。 SQL> select count(*) from custaddr partition (T_LIST510) where id='5100100386001';  COUNT(*)
    ----------
             1SQL> select count(*) from custaddr where id='5100100386001';  COUNT(*)
    ----------
             1