1、你的视图改为:
           create view v_t 
           as   select a1,a2,a3 from t1
                union all
                select a1,a2,a3 from t2
                union all
                select a1,a2,a3 from t3
                union all
                select a1,a2,a3 from t4

解决方案 »

  1.   

    union和union all是不一样的
    union all比union快很多,应为union 需要在聚合的时候检查是否有重复的!二union all就不需要!
      

  2.   

    老大你改为union all后你再看一下执行计划!
      

  3.   

    试了一下,改成union all 结果果然不同。是想象中的语句,可是为什莫 多条件就可以进行选择呢?还有,划分列一定要是主键吗?我看联机帮助说得好像是划分列必须是主键,并且在该列基础上设check条件。我理解的对吗?谢谢
      

  4.   

    1、
    应为sql都是扫描主键 分区列
    2、
    一定要!
    3、是呀!
      

  5.   

    是的,所以对于分区视图你在写where的时候,必须将你的所有主键(包括分区列)写进去如:
    这里是原来我答过的贴,你看看,实践一下就知道了!
    http://expert.csdn.net/Expert/topic/1655/1655343.xml?temp=.7236902
    http://expert.csdn.net/Expert/topic/1606/1606762.xml?temp=.9268762
      

  6.   

    看看这个http://expert.csdn.net/Expert/topic/1660/1660923.xml?temp=.702572
      

  7.   

    http://expert.csdn.net/Expert/topic/1650/1650462.xml?temp=.4220545